56,678
社区成员
发帖
与我相关
我的任务
分享
select a.id, b.cnt as cnt
from (
select distinct id
from logs) as a
left join (
select id, count(1) as cnt
from logs
where date between @bgnDate and @endDate
group by id) as b on a.id=b.id;
select a.id, isnull(b.cnt,0) as cnt
from (
select distinct id
from logs) as a
left join (
select id, count(1) as cnt
from logs
where date between @bgnDate and @endDate
group by id) as b on a.id=b.id;