我想根据基于datetime
的where子句对数据集进行分组,但我需要为Account
表中不符合where date
要求的任何用户返回计数0。这是我的SQL语句:Group By with Where
select a.userid, count(c.codeentryid)
from [account] a
left join codesentered c
on a.userid = c.userid
where a.camp = 0 and c.entrydate > '2013-12-03 00:00:00'
group by a.userid
order by a.userid
目前我得到的所有计数谁满足entrydate
需求的用户,但我怎么也将返回谁不符合为0的计数这一要求的用户?