SQL for last 4 quarters
571706Oct 30 2008 — edited Oct 31 2008Hello,
I was wondering if there is a good way to find Last 4 quarters (excluding the current quarter). So If today is Oct 30th 2008, it should show 2007-Q4, 2008-Q1, 2008-Q2, 2008-Q3.
I have a table whose column (Varchar2) in Oracle 8i has values in this format (YYYY-Q1) ie. 2008-Q1, 2008-Q2 and i want to get data where i find the match.
Example:
select * from mytable
where time_frame in ( list of last 4 quarters)
Thank you in advance.