+-------------+---------------------+
| uid | date |
+-------------+---------------------+
| 35 | 01-11-2009 19:32:44 |
| 35 | 01-13-2009 22:33:49 |
| 42 | 01-23-2009 22:08:24 |
| 42 | 02-01-2009 22:33:57 |
| 35 | 02-01-2009 22:37:34 |
| 35 | 04-20-2009 15:23:49 |
+-------------+---------------------+
我想为特定的 uid 获取每天的计数,并显示空天(在一个范围内):
User 35 (21 days)
01-11-2009 -> 1
01-12-2009 -> 0
01-13-2009 -> 1
01-14-2009 -> 0
01-15-2009 -> 0
01-16-2009 -> 0
01-17-2009 -> 0
01-18-2009 -> 0
01-19-2009 -> 0
01-20-2009 -> 0
01-21-2009 -> 0
01-22-2009 -> 0
01-23-2009 -> 0
01-24-2009 -> 0
01-25-2009 -> 0
01-26-2009 -> 0
01-27-2009 -> 0
01-28-2009 -> 0
01-29-2009 -> 0
01-30-2009 -> 0
01-31-2009 -> 0
02-01-2009 -> 1
到目前为止我得到了
SELECT MONTHNAME(date), COUNT(uid) FROM cliques_referidos WHERE uid = 35 GROUP BY YEAR(date), MONTH(date), DAY(date)
如何获得介于两者之间的天数为 0?