In MySQL I have this query:
SELECT COUNT( * ) AS `total` , DAYOFYEAR( FROM_UNIXTIME( unixtimeissued ) ) AS `dayOfYear` , YEAR( FROM_UNIXTIME( unixtimeissued ) ) AS `year`
FROM flex_information
WHERE unixtimeissued >= 'giventime'
GROUP BY dayOfYear, year
ORDER BY year, dayOfYear
LIMIT 0 , 300
This works fine except that I cannot find a way to insert 0 counts where there were no entries for a particular date. i.e. If there are no entries for '6/13/2012' I would like it to return a 'total' of 0 for that date.
EDIT: This data will be used for plotting a line chart so I will need 0 counts paired with the date in order to successfully display an accurate chart - I could fill in the zero values in PHP but a MySQL query would be much less system intensive.
I found this answer: MySQL how to fill missing dates in range?: I now have a 'numbers' table but have been unable to successfully adapt the solution to my query. Some of what I assume is shorthand syntax is making it difficult for me to understand the concepts.