小计

select ifnull(d.count,0)count,c.days from (select date_format(a.created_at,'%Y-%m-%d') days from app_award_log a,app_member_info b where a.game_type=1 and a.app_member_info_id=b.id
and a.created_at between '2014-08-10 00:00:00' and '2014-11-26 23:59:59' group by days)c left join
(select count(0) count, date_format(a.created_at,'%Y-%m-%d') days,b.id from app_award_log a,app_member_info b
where a.game_type=1 and a.app_member_info_id=b.id
and a.created_at between '2014-08-10 00:00:00' and '2014-11-26 23:59:59' and b.app_shop_circle_id =1 group by days)d on c.days=d.days;

posted @ 2015-01-14 16:46  火腿骑士  阅读(126)  评论(0编辑  收藏  举报