清除在已在銷售中消化,使用校正後又重新插入的資料(寶豐財務)

來源:互聯網
上載者:User

--清除在已在銷售中消化,使用校正後又重新插入的資料
drop table pcje2007
select lsh,pcrq,xmbm,ph,sqys,sqyje,bqss,bqsje,bqfs,bqfje,jcs,pcs,sqyje+bqsje-bqfje+(dslsj*(pcs-jcs)) as pcje,round(PCS*DSLSJ,2) AS PCJE2 into pcje2007  from zy_yp1_pcb where datediff(mm,pcrq,'2007-01-01')=0
delete from pcje2007 where sqys=0 and bqss=0 and bqfs=0 and jcs=0 and pcs=0

select a.pcrq,b.pcrq,a.xmbm,a.ph,a.sqyje,b.pcje,B.PCJE2 from zy_yp1_pcb a,pcje2007 b where datediff(mm,a.pcrq,'2007-2-01')=0 and a.xmbm=b.xmbm and a.ph=b.ph and ABS(a.sqyje-b.pcje2)>0

select * into pcb200701 from zy_yp1_pcb
update zy_yp1_pcb set sqyje=B.PCJE2 from zy_yp1_pcb a,pcje2007 b where datediff(mm,a.pcrq,'2007-1-01')=0 and a.xmbm=b.xmbm and a.ph=b.ph and ABS(a.sqyje-b.pcje2)>0
SELECT * FROM ZY_SYS2_YPZDK WHERE GBM='11097570'

update zy_yp1_pcb set dslsj=round((sqyje+bqsje)/((case (sqys+bqss) when 0 then 1 else sqys+bqss end)),4) from zy_yp1_pcb where abs((sqyje+bqsje)/((case (sqys+bqss) when 0 then 1 else sqys+bqss end))-dslsj)>1 and  datediff(mm,pcrq,'2007-2-01')=0 and round((sqyje+bqsje)/((case (sqys+bqss) when 0 then 1 else sqys+bqss end)),4)<>0
select xmbm,dslsj,round((sqyje+bqsje)/((case (sqys+bqss) when 0 then 1 else sqys+bqss end)),4) from zy_yp1_pcb where abs((sqyje+bqsje)/((case (sqys+bqss) when 0 then 1 else sqys+bqss end))-dslsj)>1 and  datediff(mm,pcrq,'2007-2-01')=0 and round((sqyje+bqsje)/((case (sqys+bqss) when 0 then 1 else sqys+bqss end)),4)<>0

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.