日期:2014-05-17 浏览次数:20864 次
select ryb.[Name] 姓名,isnull(tjs.b,0) 己写周报数, (select count(*) from 周期表 as zqb)-isnull(tjs.b,0)+isnull(tjs.c,0) 未写周报数
from 人员表 as ryb left join
( select MemberID,count(*) as b,
(select count(*) from 免写表 as mxb where MemberID=zbb.MemberID ) as c
from 周报表 as zbb
where not exists(select 1 from 免写表 as mxb where MemberID=zbb.MemberID and StartTime=zbb.StartTime and EndTime=zbb.EndTime )
group by MemberID ) as tjs on ryb.MemberID=tjs.MemberID
order by ryb.MemberID