首页 新闻 会员 周边

mysql 日期统计,怎么把没有数据的日期也显示出来

0
悬赏园豆:50 [已关闭问题] 关闭于 2015-06-05 16:36
select
date_format(qar.create_date, '%y-%m-%d') as qarcreatedate,
(case when qar.create_date > 0 then qar.id 
when qar.create_date = "null" then 0 end
) as qarid
from
xx_qrcode q
left join xx_qrcode_access_record qar on qar.qrcode_id = q.id
right join xx_product p on q.product_id = p.id
where
p.stores is null
and qar.create_date between '2015-05-29' and '2015-06-05'
group by qar.create_date

结果:
qarCreateDate qarid
2015-05-29 0
2015-05-30 0
2015-05-31 0
2015-06-01 0


2015-06-02267
2015-06-03268
2015-06-03269
2015-06-04270
2015-06-04271


,05-29—06-01是没查出来
请问怎么将2015-05-29,2015-05-30,2015-05-31和2015-06-01 这些不存在的也统计出来。非常感谢各位的指点!

贤龙的主页 贤龙 | 初学一级 | 园豆:104
提问于:2015-06-05 16:05
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册