I can get date range data 15/02 - 21/06 every year from the query below.
SELECT * FROM dim_date WHERE EXTRACT (MONTH FROM date_cal) BETWEEN 3 AND 5 OR (EXTRACT (MONTH FROM date_cal) = 2 AND EXTRACT (DAY FROM date_cal) >= 15) OR (EXTRACT (MONTH FROM date_cal) = 6 AND EXTRACT (DAY FROM date_cal) <= 21)
But the problem is that when I want to find the year 2010 - 2012 , I get the same result.
The range I want to get is:
2010-02-15 - 2010-06-15 2011-02-15 - 2011-06-15 2012-02-15 - 2012-06-15 SELECT * FROM dim_date WHERE EXTRACT (MONTH FROM date_cal) BETWEEN 3 AND 5 OR (EXTRACT (MONTH FROM date_cal) = 2 AND EXTRACT (DAY FROM date_cal) >= 15) OR (EXTRACT (MONTH FROM date_cal) = 6 AND EXTRACT (DAY FROM date_cal) <= 21) AND EXTRACT (YEAR FROM date_cal) BETWEEN 2010 AND 2012
Who can help me?
source share