Possible Duplicate:
MySQL how to fill missing dates in range?
I'm trying to make a graph from mysqldata,
Postid | date | text
1 | 2012-01-01 | bla
2 | 2012-01-01 | bla
3 | 2012-01-02 | bla
4 | 2012-01-02 | bla
5 | 2012-01-04 | bla
6 | 2012-01-04 | bla
7 | 2012-01-05 | bla
Now, I'd like to get the number of posts on every day, INCLUDING dates with zero. For example, i'd like to be able to get the first week like this:
date | count(Postid)
2012-01-01 | 2
2012-01-02 | 2
2012-01-03 | 0
2012-01-04 | 2
2012-01-05 | 1
2012-01-06 | 0
2012-01-07 | 0
I'm looking for a generic solution, where i don't have to specify every date. Any suggestions?