Clear data that has been digested in sales and re-inserted after verification (Baofeng finance)

Source: Internet
Author: User

-- Clear the data that has been digested in sales and re-inserted after verification.
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, '2017-01-01 ') = 0
Delete from pcje2007 where sqys = 0 and bqss = 0 and bqfs = 0 and JCs = 0 and PCs = 0

Select. pcrq, B. pcrq,. xmbm,. pH,. sqyje, B. pcje, B. pcje2 from zy_yp1_pcb A, pcje2007 B where datediff (mm,. pcrq, '2014-2-01 ') = 0 and. xmbm = B. xmbm and. pH = B. pH and ABS (. sqyje-b.pcje2)> 0

Select * into limit 200701 from zy_yp1_pcb
Update zy_yp1_pcb set sqyje = B. pcje2 from zy_yp1_pcb A, pcje2007 B where datediff (mm,. pcrq, '2017-1-01 ') = 0 and. xmbm = B. xmbm and. pH = B. pH and ABS (. sqyje-b.pcje2)> 0
Select * From zy_sys2_ypzdk where GBM = '2013'

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, '2014-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, '2014-2-01 ') = 0 and round (sqyje + bqsje)/(Case (sqys + bqss) When 0 then 1 else sqys + bqss end )), 4) <> 0

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.