Update Financial Statements 2

Source: Internet
Author: User

--Query month service days are not equal to the number of month service days stored in the database

Select B.day1,a.days_of_month from Erp_work_day_opt_info_copy A, (select count (DISTINCT service_day) as Day1, order_id From erp_work_day_opt_info_copy where Service_day >= ' 2015-08-01 ' and Service_day <= ' 2015-08-01 ' and order_state = 4 GROUP by order_id) b where a.order_id = b.order_id and service_day = ' 2015-08-01 ' and order_state =4 and b.day1! = A . days_of_month

--Query the month service days before and after the change select A.order_id,a.days_of_month,ac.days_of_month from Erp_work_day_opt_info_copy ac,erp_work_ Day_opt_info a WHERE ac.id = a.id and ac.order_state = 4 and A.days_of_month! = ac.days_of_month and ac.service_day = ' 20 15-08-06 '

--Update month service days update erp_work_day_opt_info_copy a set a.days_of_month = (select Day1 from (select COUNT (DISTINCT service _day) as day1,order_id from erp_work_day_opt_info_copy where Service_day >= ' 2015-08-01 ' and Service_day <= ' 2015- 08-31 ' and Order_state =4 GROUP by order_id] b where a.order_id =b.order_id) where service_day = ' 2015-08-31 ' an D order_state =4

--No. 3rd, Month service days not equal to 1 error data SELECT days_of_month from Erp_work_day_opt_info where order_id in (1116111412293638431, 11161120 1503260001, 161410111705426422, 16150523100003515937, 16150624114818157101, 1620150406140658405541, 1620150422183741941759) and service_day = ' 2015-08-03 ' and order_state = 4;

--Inquiry August 1 The unit price is not equal to the monthly service amount SELECT * from Erp_work_day_opt_info_copy A, Erp_work_order b WHERE service_day like '%2015-08-0 1% ' and a.order_id = b.order_id and A.customer_price_per_day! = A.money_of_month and a.order_state = 4

--Query

Select a. order_id from Erp_work_order A, (SELECT order_id, COUNT (DISTINCT service_day) from Erp_work_day_opt_info_cop Y WHERE service_day like ' 2015-08% ' and rest_service_days <= 0 and order_state = 4 GROUP by order_id have count (DI Stinct service_day) > 1) b where a.order_id =b.order_id and A.inner_flag =0

--Query the SELECT * from Erp_work_day_opt_info_copy where order_id in (select order_id from Erp_work_day for days remaining less than or equal to 0 and greater than 1 days _opt_info_copy WHERE service_day like ' 2015-08% ' and rest_service_days <= 0 and order_state = 4 GROUP by order_id HAV ING count (DISTINCT service_day) > 1)

and service_day like ' 2015-08% ' and rest_service_days <= 0 ORDER by order_id Desc

Update Financial Statements 2

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.