现在有一张xx表,表里面有如下的数据,字段名为create_date(如下1)
我用
select create_date, count(0) from xx where create_date BETWEEN date('2014-08-01') AND date('2014-09-01') group by create_date
去做个分组统计,得到了(如下2)的数据,没有19号的数据
问题:如何才能使统计的时候,即使没有19号的数据,也能得到一个0呢。
1:
create_date
2014-08-18
2014-08-20
2014-08-20
2014-08-20
2014-08-18
2014-08-20
2014-08-21
2014-08-22
2014-08-22
2014-08-22
2014-08-22
2014-08-22
2014-08-22
2014-08-22
2:
2014-08-18 2
2014-08-20 4
2014-08-21 1
2014-08-22 7