I have the following table
I would like help coding a query that filter on the table using the current_date() and retrieve only those rows using the field as_of_date to retrieve end of last quarter i.e.Last Quarter End For example the output would look like the following
I think the solution needs a CASE STATEMENT, but I'm not sure.
Below is the sample table
CREATE TABLE #tmpTable (
as_of_date varchar(50),
ColA varchar(50),
ColB varchar(50))
INSERT #tmpTable VALUES
('31/05/2023','LM','a'),
('31/03/2023','LQ','b'),
('31/12/2022','LY','c'),
('30/04/2023','LM2','d'),
('30/09/2022','LQ2','e'),
('31/12/2021','LY2','f')
SELECT * FROM #tmpTable
Any help greatly appreciated.