发布网友
共1个回答
热心网友
select flbh,flmc,bmbm,bmmc, jfje,(select bmmc from appsys_bmywgx where ywlb='002' and glbmbh=?sskbm) mc from (select wzbm,bmbh,sum(jfje) jfje from (select substr(wzbm,0,2) wzbm,(select bmbh from gy_sztjb b where INSTR (';'||a.wzbm, ';'||b.flbh,1)=1) bmbh ,jfje from gy_cc_kclsb a where (dzlb=-1 or dzlb=1 or dzlb=2 ) and sskbm=?sskbm and substr(ckbm,4,1)='1' and (to_date(to_char(dzrq,'yyyy-MM-dd'),'yyyy-MM-dd') between ?kssj and ?jssj)) a group by wzbm,bmbh) a,(select flbh,flmc,bmbm,bmmc from (select wzfl.flbh,wzfl.flmc from gy_wzflb wzfl where length(wzfl.flbh)=2)a,(select a.bmbm,b.bmmc from appsys_bmfl a,appsys_bmxx b where a.bmlb='022' and a.bmbm=b.bmbh)b) b where b.flbh=a.wzbm(+) and b.bmbm=a.bmbh(+) --order by flbh,bmbh
--union select '01','设备','11010101','调拨入库',null,null from al\nunion\nselect flbh, flmc,
'01010109' bmbm,'调拨入库' bmmc, jfje,
(select bmjc from appsys_bmfl where bmlb='002' and bmbm=(select aa.bmbh from appsys_bmywgx aa where aa.ywlb='002' and aa.glbmbh=?sskbm)) mc from
(select wzbm,sum(jfje) jfje from
(select substr(wzbm,0,2) wzbm,jfje
from gy_cc_kclsb a where (dzlb=8 or dzlb=10) and sskbm=?sskbm and substr(ckbm,4,1)='1'
and (to_date(to_char(dzrq,'yyyy-MM-dd'),'yyyy-MM-dd') between ?kssj and ?jssj)
) a group by wzbm) a,
(select wzfl.flbh,wzfl.flmc from gy_wzflb wzfl where length(wzfl.flbh)=2 order by flbh)c where c.flbh=a.wzbm(+)
union
select flbh, flmc,
'01010110' bmbm,'冲账入库' bmmc, jfje,
(select bmjc from appsys_bmfl where bmlb='002' and bmbm=(select aa.bmbh from appsys_bmywgx aa where aa.ywlb='002' and aa.glbmbh=?sskbm)) mc from
(select wzbm,sum(jfje) jfje from
(select substr(wzbm,0,2) wzbm,jfje
from gy_cc_kclsb a where (dzlb=3) and sskbm=?sskbm and substr(ckbm,4,1)='1'
and (to_date(to_char(dzrq,'yyyy-MM-dd'),'yyyy-MM-dd') between ?kssj and ?jssj)
) a group by wzbm) a,
(select wzfl.flbh,wzfl.flmc from gy_wzflb wzfl where length(wzfl.flbh)=2 order by flbh)c where c.flbh=a.wzbm(+)