日期:2014-05-18 浏览次数:20578 次
SELECT SUM(VW_LSXHMX.SL*ISNULL(VW_LSXHMX.DJ_3,0) ) AS CBJE FROM [color=#FF0000]( select DJXZ,DJMC,DJBH,RQ,YSRQ,JZRQ,DM1,DM2,QDDM,YGDM,YS,JZ,JS,ZDR,YSR,JZR,JSR,BZ,SPDM, SUM(SL) AS SL,SUM(SL*CKJ) AS BZJE,sum(JE) AS JE,sum(BYZD9) AS BYZD9,LX from VW_LSXHMX_A GROUP BY DJXZ,DJMC,DJBH,RQ,YSRQ,JZRQ,DM1,DM2,QDDM,YGDM,YS,JZ,JS,ZDR,YSR,JZR,JSR,BZ,SPDM,LX )[/color] VW_LSXHMX left outer join (select distinct LSDJBH,RQ,SPDM,DM1,sum(SL) as SL,sum(JE) as JE,SUM(JE_2) AS JE_2 from VW_SDJSD where VW_SDJSD.JZ='1' GROUP BY LSDJBH,RQ,SPDM,DM1) VW_SDJSD on VW_LSXHMX.DJBH=VW_SDJSD.LSDJBH AND VW_LSXHMX.SPDM=VW_SDJSD.SPDM AND VW_LSXHMX.DM1=VW_SDJSD.DM1,SHANGPIN,KEHU,DANWEI,FJSX1,FJSX2,FJSX3,FJSX4 WHERE VW_LSXHMX.SPDM=SHANGPIN.SPDM AND VW_LSXHMX.DM1=KEHU.KHDM AND SHANGPIN.DWMC = DANWEI.DWDM AND SHANGPIN.FJSX1=FJSX1.SXDM AND SHANGPIN.FJSX2=FJSX2.SXDM AND SHANGPIN.FJSX3=FJSX3.SXDM AND SHANGPIN.FJSX4=FJSX4.SXDM [color=#FFFF00]AND ((VW_LSXHMX.LX = '0') ) [/color]GROUP BY KEHU.KHDM,KEHU.KHMC,KEHU.BYZD8
select DJXZ,DJMC,DJBH,RQ,YSRQ,JZRQ,DM1,DM2,QDDM,YGDM,YS,JZ,JS,ZDR,YSR,JZR,JSR,BZ,SPDM, SUM(SL) AS SL,SUM(SL*CKJ) AS BZJE,sum(JE) AS JE,sum(BYZD9) AS BYZD9,LX from VW_LSXHMX_A GROUP BY DJXZ,DJMC,DJBH,RQ,YSRQ,JZRQ,DM1,DM2,QDDM,YGDM,YS,JZ,JS,ZDR,YSR,JZR,JSR,BZ,SPDM,LX
------解决方案--------------------