Below is my mysql table:
-------------------------- ID Date_From Date_To -------------------------- 1 2011-02-01 2011-02-28 2 2012-09-01 2012-09-30
You need to use query like this:
SELECT * FROM TIME_PERIOD WHERE (YEAR(DATE_FROM) >= '2013' OR (YEAR(DATE_FROM) >= '2012' AND MONTH(DATE_FROM) >= '10')) AND (YEAR(DATE_TO) <= '2013' AND MONTH(DATE_TO) <= '12');