Select distinct year and order by
I'm trying to pull a list of years from my databases date column for the purposes of populating a <select> list.
I have the following query:
I've put this through a ColdFusion cfoutput tag and used the group= attribute to remove the duplicate years, but I'm still getting some duplicates, so I'm wondering if there's an easy way to do it in the SQL. I can't seem to use DISTINCT because it doesn't play well with ORDER BY, and I need the years to go most recent to oldest.
SELECT YEAR(fulldate_issued) AS year_issued
WHERE fulldate_issued IS NOT NULL
ORDER BY year_issued DESC