Below is my mysql table:
--------------------------
ID Date_From Date_To
--------------------------
1 2011-02-01 2011-02-28
2 2012-09-01 2012-09-30
3 2012-10-01 2012-10-30
4 2012-11-01 2012-11-30
5 2012-12-01 2012-12-30
6 2013-01-01 2013-01-30
7 2014-03-01 2014-03-31
I have this mysql statement:
SELECT *
FROM TIME_PERIOD
WHERE
(YEAR(DATE_FROM) >= '2012' AND MONTH(DATE_FROM) >= '10')
AND (YEAR(DATE_TO) <= '2013' AND MONTH(DATE_TO) <= '12');
which returns only the records with ID 3, 4, and 5. What Im expecting to return are records with ID 3, 4, 5, and 6.
Please help.
You need to use query like this: