Consider the following "messages" table:
_date message
-------------------------
2012-02-22 hello
2012-02-22 another msg!
2012-03-05 foobar
2012-03-22 testing
2012-03-22 goodbye
2012-03-22 test test
I want to count the number of messages per day, but also want to include all the days on which there are no messages. Say I want to count all messages between 2012-02-01 and 2012-03-29, then the query result should be:
_date messsages
----------------------
2012-02-01 0
2012-02-02 0
...
2012-02-22 2
2012-02-23 0
...
2012-03-01 0
2012-03-02 0
2012-03-03 0
2012-03-04 0
2012-03-05 1
...
2012-03-22 3
...
2012-03-29 0
Is this possible within MySQL?