How to quickly select DISTINCT Years from a timestamp field in MySQL
I am wondering if there is a good-performing query to select distinct years (ignoring times, days and months) from a table with a timestamp field in MySQL.
My best guess is:
SELECT DISTINCT date ('Y', strtotime(mydatefield)) As mydatefield
FROM mytable
but this is not a valid MySQL syntax. Please help.
Regards
Rune