我想取出 里面chint—code等字段罗列出来 就大神们帮忙
select sum1-sum2 from (
select sum(bbje) as sum1 from(
select chint_manager.chint_code as chint_code, chint_manager.subscribedate as subscribedate,
chint_manager.projectid as projectid, bd_cubasdoc.custcode as custcode, chint_manager.operid as operid,
bd_cubasdoc.bp2 as bp2, chint_manager.promanager as promanager, chint_manager.nbhtje as nbhtje,
chint_manager.paycom as paycom, chint_manager.nbhtje-chint_manager.paycom as bcqk,
bd_jobbasfil.jobname as jobname, bd_cubasdoc.custname as custname, bd_cubasdoc.custcode as custcode,arap_djzb.paydate as paydate,
arap_djfb.sfbz as sfbz, arap_djlx.dr as dr, arap_djlx.djlxbm as djlxbm, arap_djzb.bbje as bbje,
arap_djlx.dwbm as dwbm
from chint_manager
inner join bd_cumandoc on chint_manager.promanager = bd_cumandoc.pk_cumandoc
inner join bd_cubasdoc on bd_cumandoc.pk_cubasdoc = bd_cubasdoc.pk_cubasdoc
inner join bd_jobmngfil on chint_manager.projectid = bd_jobmngfil.pk_jobmngfil
inner join bd_jobbasfil on bd_jobmngfil.pk_jobbasfil = bd_jobbasfil.pk_jobbasfil
inner join bd_corp on bd_cumandoc.pk_corp = bd_corp.pk_corp
inner join arap_djzb on bd_cumandoc.pk_cumandoc = arap_djzb.zyx2
inner join arap_djfb on arap_djzb.vouchid = arap_djfb.vouchid
inner join arap_djlx on arap_djzb.djlxbm = arap_djlx.djlxbm
)aa
where aa.djlxbm in ('D0','2349','2346','D1','23A1') and aa.sfbz=3 and aa.dr=0 and
aa.dwbm=1004
)cc
left outer join
(
select sum(bbje) as sum2 from(
select chint_manager.chint_code as chint_code, chint_manager.subscribedate as subscribedate,
chint_manager.projectid as projectid, bd_cubasdoc.custcode as custcode, chint_manager.operid as operid,
bd_cubasdoc.bp2 as bp2, chint_manager.promanager as promanager, chint_manager.nbhtje as nbhtje,
chint_manager.paycom as paycom, chint_manager.nbhtje-chint_manager.paycom as bcqk,
bd_jobbasfil.jobname as jobname, bd_cubasdoc.custname as custname, bd_cubasdoc.custcode as custcode,arap_djzb.paydate as paydate,
arap_djfb.sfbz as sfbz, arap_djlx.dr as dr, arap_djlx.djlxbm as djlxbm, arap_djzb.bbje as bbje,
arap_djlx.dwbm as dwbm
from chint_manager
inner join bd_cumandoc on chint_manager.promanager = bd_cumandoc.pk_cumandoc
inner join bd_cubasdoc on bd_cumandoc.pk_cubasdoc = bd_cubasdoc.pk_cubasdoc
inner join bd_jobmngfil on chint_manager.projectid = bd_jobmngfil.pk_jobmngfil
inner join bd_jobbasfil on bd_jobmngfil.pk_jobbasfil = bd_jobbasfil.pk_jobbasfil
inner join bd_corp on bd_cumandoc.pk_corp = bd_corp.pk_corp
inner join arap_djzb on bd_cumandoc.pk_cumandoc = arap_djzb.zyx2
inner join arap_djfb on arap_djzb.vouchid = arap_djfb.vouchid
inner join arap_djlx on arap_djzb.djlxbm = arap_djlx.djlxbm
)bb
where bb.djlxbm in ('D1','D2','2347','2348','23A0','F1-YJYF','F1-XMF','F1-BZJ')
and bb.sfbz=3 and bb.dr=0 and bb.dwbm=1004
)dd
on 1=1