I am using this:
SELECT FROM_UNIXTIME(my_unix_timestamp_column, \'%Y\') AS year FROM table_name WHERE year = 2009;
but it gives me an error
Another alternative, avoiding repetition of a biggish function call:
SELECT year
FROM (SELECT FROM_UNIXTIME(my_unix_timestamp_column, '%Y') AS year
FROM table_name) AS list_of_years
WHERE year = 2009;
You might still need to use back-quotes around the word 'year' to avoid conflicts with YEAR as a keyword. The optimizer should not need to create an intermediate table to answer this query.