One programming practice [ASP + MSSQL]

Source: Internet
Author: User
Tags mssql
I am a rubber and plastic product manufacturer. In February, the organization leader asked me to develop a production process data checklist to check the accuracy of the process data. The basic principles of the report are as follows:
Subsequent processes: number of genuine products today + number of decommissioned products in subsequent processes today = number of genuine products in this process today + number of items retained in this process today-number of items retained in this process yesterday
After learning about the principle, we will start work immediately. We will consider using a temporary table for the first time:
Select distinct LEFT (productid, 4) + '00' as productid into # productid from yuancaiFlow_view
Where productiondate = '2017-3-1'
And productid like '01 ____'
Go
Select a. productid,
B. productname,
Isnull (hj. GoodQty, 0) as hj_good,
Isnull (hjtoday. qty, 0) as hj_today,
Isnull (hjyesterday. qty, 0) hj_yesterday,
Isnull (hj. goodQty, 0)-isnull (hjtoday. qty, 0) + isnull (hjyesterday. qty, 0)-isnull (sx. goodQty, 0)-isnull (sx. badQty, 0) as hj_difference,
Isnull (sx. GoodQty, 0) as sx_good,
Isnull (sx. BadQty, 0) as sx_bad,
Isnull (sxtoday. qty, 0) as sx_today,
Isnull (sxyesterday. qty, 0) sx_yesterday,
Isnull (sx. goodQty, 0)-isnull (sxtoday. qty, 0) + isnull (sxyesterday. qty, 0)-isnull (jt. goodQty, 0)-isnull (jt. badQty, 0) as sx_difference,
Isnull (jt. GoodQty, 0) as jt_good,
Isnull (jt. BadQty, 0) as jt_bad,
Isnull (jttoday. qty, 0) as jt_today,
Isnull (jtyesterday. qty, 0) jt_yesterday,
Isnull (jt. goodQty, 0)-isnull (jttoday. qty, 0) + isnull (jtyesterday. qty, 0)-isnull (ph. goodQty, 0)-isnull (ph. badQty, 0) as jt_difference,
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.