I have a datetime query that works qreat:
$q="SELECT COUNT(blocked) AS sum_blocked, DATE(created) AS date_label ".
"FROM sms_subscribers WHERE blocked=0 GROUP BY DATE(created)";
The only problem is I can not figure out how / if I can fill dates with zero results with zero or null.
ie; if there are 5 records for 2011-08-25 and 7 records for 2011-08-27, I would like the result to return 5, 0, 7 or 5, null, 7
Any help would be greatly appreciated!
You could create an additional table with number of days and join two tables. Here it is an example, it works for specified month –