雪
雪狐狸
Unregistered / Unconfirmed
GUEST, unregistred user!
select danwei.bmid,danwei.Tnumber,danwei.name,danwei.gwzg,danwei.gwfg,danwei.gwzj,danwei.gwcj,isnull(A.ZG,0) as ZG,isnull(B.FG,0) as FG,isnull(C.ZJ,0) as ZJ,isnull(D.CJ,0) as CJ from danwei
left join (select dwid,COUNT(*) as ZG from ryb where (zcjb=1)group by dwid) as A on A.dwid=danwei.Tnumber
left join (select dwid,COUNT(*) as FG from ryb where (zcjb=2)group by dwid) as B on B.dwid=danwei.Tnumber
left join (select dwid,COUNT(*) as ZJ from ryb where (zcjb=3)group by dwid) as C on C.dwid=danwei.Tnumber
left join (select dwid,COUNT(*) as CJ from ryb where (zcjb=4) or (zcjb=5)group by dwid) as D on D.dwid=danwei.Tnumber
left join (select dwid,COUNT(*) as ZG from ryb where (zcjb=1)group by dwid) as A on A.dwid=danwei.Tnumber
left join (select dwid,COUNT(*) as FG from ryb where (zcjb=2)group by dwid) as B on B.dwid=danwei.Tnumber
left join (select dwid,COUNT(*) as ZJ from ryb where (zcjb=3)group by dwid) as C on C.dwid=danwei.Tnumber
left join (select dwid,COUNT(*) as CJ from ryb where (zcjb=4) or (zcjb=5)group by dwid) as D on D.dwid=danwei.Tnumber