SELECT count(1) sumcou,
count(1) - sum(case
when lib.IS_HANDOVER = 'handover01' then
1
when lib.IS_HANDOVER = 'handover02' then
0
else
0
end) cou,
rela.contract_id
FROM LB_DOCRELATIVE rela
LEFT JOIN LB_DOCLIBRARY lib
ON rela.id = lib.relative_id
WHERE lib.doc_nature in ('01', '03')
and lib.doc_Class_Itemno in ('110001')
group by rela.contract_id) v
count(1) - sum(case
when lib.IS_HANDOVER = 'handover01' then
1
when lib.IS_HANDOVER = 'handover02' then
0
else
0
end) cou,
rela.contract_id
FROM LB_DOCRELATIVE rela
LEFT JOIN LB_DOCLIBRARY lib
ON rela.id = lib.relative_id
WHERE lib.doc_nature in ('01', '03')
and lib.doc_Class_Itemno in ('110001')
group by rela.contract_id) v
23万+

被折叠的 条评论
为什么被折叠?



