无
无头骑士
Unregistered / Unconfirmed
GUEST, unregistred user!
select QCBH,KHBH,KHMC,yjdf+SJDF as SJDF,JSDF,JYYE
,(jsdf-(select sum(sjdf)
from POWER.zw_dfsj a
where a.ssny=:ad_ssny
and a.dwbh=:as_dwbh and sfbz<>'6'
and a.sjlb='2' and a.khbh=b.khbh
group by qcbh,khbh,ssny)) as KDS
from POWER.zw_dfsj b
where b.ssny=:ad1_ssny
and b.dwbh=:as1_dwbh
AND B.SJLB='2'
and ( nvl((SELECT sum(JYYE) FROM power.ZW_DFSJ
WHERE KHBH=B.KHBH AND SYYESJBH=B.SJBH and sjlb='2' AND SFBZ NOT IN ('4','6','9','b')),0)>0
or ((jsdf-(select sum(sjdf)
from POWER.zw_dfsj a
where a.ssny=:ad2_ssny
and a.dwbh=:as2_dwbh and sfbz<>'6'
and a.sjlb='2' and a.khbh=b.khbh
group by qcbh,khbh,ssny)))>0
)
order by B.qcbh,b.khbh
,(jsdf-(select sum(sjdf)
from POWER.zw_dfsj a
where a.ssny=:ad_ssny
and a.dwbh=:as_dwbh and sfbz<>'6'
and a.sjlb='2' and a.khbh=b.khbh
group by qcbh,khbh,ssny)) as KDS
from POWER.zw_dfsj b
where b.ssny=:ad1_ssny
and b.dwbh=:as1_dwbh
AND B.SJLB='2'
and ( nvl((SELECT sum(JYYE) FROM power.ZW_DFSJ
WHERE KHBH=B.KHBH AND SYYESJBH=B.SJBH and sjlb='2' AND SFBZ NOT IN ('4','6','9','b')),0)>0
or ((jsdf-(select sum(sjdf)
from POWER.zw_dfsj a
where a.ssny=:ad2_ssny
and a.dwbh=:as2_dwbh and sfbz<>'6'
and a.sjlb='2' and a.khbh=b.khbh
group by qcbh,khbh,ssny)))>0
)
order by B.qcbh,b.khbh