In the #maria IRC channel the other day I fielded a question someone had about a DATETIME column where they wanted to SELECT by the year. The answer (which is probably obvious to many of you) is to use the YEAR() function like so:
select * from t1 where YEAR(d) = 2011;
(The above assumes the table is named “t1” and the DATETIME column is named “d“.)
In my reply I provided a link to the Date and Time Functions section of the AskMonty Knowledgebase, but when I looked at the entry for the …
[Read more]