I want to count the number of rows I have in a specific table bundled up in year-month buckets depending on the create date - I have SQL that will do that -
SELECT DATE_FORMAT( create_date, '%Y%m' ) AS date, count( entry_no ) AS counts FROM MyTable GROUP BY DATE_FORMAT( create_date, '%Y-%m') so far so good but there are gaps so for instance in Jan 2009 there may be now records so I don't have an entry for that data bucket but I want to report zero for that time period. I'm thinking that I need to set up an array initialized to all zeros for all time buckets and then fill in real values where they exist ...
i) How would I do that?
ii) Is there a better way?