日期:2014-05-18 浏览次数:20792 次
select u.nickname,u.uid,(select count(1) from tbl_daily d where d.D_Uid=u.uid AND '2012-02-14'<=d.D_Submitted and d.D_Submitted<='2012-02-15') as cnt from dnt_users u where u.groupid in(1,14,15,8,3,18) group by u.username;
select u.nickname,u.uid,isnull(d.cnt,0) as cnt from dnt_users u left join (select D_Uid,count(1) as cnt from tbl_daily '2012-02-14'<=d.D_Submitted and d.D_Submitted<='2012-02-15' ) d on d.D_Uid=u.uid AND where u.groupid in(1,14,15,8,3,18)
------解决方案--------------------