I'm a part-time designer/developer with a part-time photography business. I've got a database of photos with various bits of metadata attached. I want to query the database and return a list of the years that photos were taken, and the quantity of photos that were taken in that year.
In short, I want a list that looks like this:
2010 (35 photos)
2009 (67 photos)
2008 (48 photos)
Here's the query I'm using:
SELECT YEAR(date) AS year, COUNT(filename) as quantity FROM photos WHERE visible='1' GROUP BY 'year' ORDER BY 'year' DESC
Instead of churning out all the possible years (the database includes photos from 2010-2008), this is the sole result:
2010 (35 photos)
I've tried a lot of different syntax but at this point I'm giving in and asking for help!