Go for
MONTH[
^].
id happend_at<br />
-- ----------------<br />
1 2009-01-01 12:08<br />
2 2009-02-01 12:00<br />
3 2009-01-12 09:40<br />
4 2009-01-29 17:55
And let's say you want to execute to find all the records that have a
happened_at
during the month 2009/01 (January 2009). The SQL query would be:
SELECT id FROM things
WHERE MONTH(happened_at) = 1 AND YEAR(happened_at) = 2009
<br />
output<br />
id<br />
---<br />
1<br />
3<br />
4
src : stackoverflow[^]
-KR