Change financial statement data

Source: Internet
Author: User

SELECT * from Rpt_history_money where Customer_price_per_day =0 and Real_pay_money <0

SELECT * from Rpt_history_money_detail where Customer_price_per_day <0;


SELECT * from Rpt_history_money where date (serviced_days) > Date (beable_service_days);

SELECT count (DISTINCT service_day), order_id from Erp_work_day_opt_info where service_day like ' 2015-08% ' and rest_ Service_days =0 and Order_state =4 GROUP by order_id have COUNT (DISTINCT service_day) >1


SELECT * FROM Rpt_history_money a JOIN (select count (DISTINCT service_day) – 1 as AAA, order_id from Erp_work_day_opt_info where Service_day like ' 2015-08% ' and rest_service_days =0 and Order_state =4 GROUP by order_id have COUNT (DISTINCT serv Ice_day) >1
) b on a.order_id = b.order_id where a.month = ' 2015-08 ';

SELECT count (DISTINCT service_day), order_id from Erp_work_day_opt_info where service_day like ' 2015-08% ' and order_state =4 GROUP by order_id

SELECT * FROM Rpt_history_money a joins (SELECT count (DISTINCT service_day) as aaa,order_id from Erp_work_day_opt_info wher E service_day like ' 2015-08% ' and Order_state =4 GROUP by order_id
B on a.order_id = b.order_id where a.month = ' 2015-08 ' and aaa! = A.days_of_month;

Update Rpt_history_money a JOIN (SELECT count (DISTINCT service_day) as aaa,order_id from Erp_work_day_opt_info where servi Ce_day like ' 2015-08% ' and Order_state =4 GROUP by order_id
B on a.order_id = b.order_id set days_of_month = AAA where A.month = ' 2015-08 ' and aaa! = A.days_of_month;

Update Rpt_history_money a JOIN (SELECT count (DISTINCT service_day)-1 as AAA, order_id from Erp_work_day_opt_info where s Ervice_day like ' 2015-08% ' and rest_service_days =0 and Order_state =4 GROUP by order_id have COUNT (DISTINCT service_day ) >1
) b on a.order_id = b.order_id set days_of_month = AAA where A.month = ' 2015-08 ';

Update Rpt_history_money Set money_of_month = Customer_price_per_day * days_of_month;


SELECT count (DISTINCT service_day) -1,order_id,service_user_name,serivce_user_type from Erp_work_day_opt_info where Service_day like ' 2015-08% ' and rest_service_days =0 and Order_state =4 GROUP by order_id, Serivce_user_type, Service_use R_name
Having COUNT (DISTINCT service_day) >1;

Update Rpt_history_money_detail a JOIN (SELECT count (DISTINCT service_day)-1 as Aaa,order_id,service_user_name, Serivce_user_type from Erp_work_day_opt_info where service_day like ' 2015-08% ' and rest_service_days =0 and Order_state =4 GROUP by order_id, Serivce_user_type, Service_user_name
have COUNT (DISTINCT service_day) >1
) b on a.order_id = b.order_id and A.serivce_user_type =b.serivce_user_type and B.service_user_name =a.service_user_name set days_of_ month = days_of_month-aaa where a.month = ' 2015-08 ';

SELECT * FROM Rpt_history_money_detail a JOIN (select count (DISTINCT service_day)-1 as Aaa,order_id,service_user_name, Serivce_user_type from Erp_work_day_opt_info where service_day like ' 2015-08% ' and rest_service_days =0 and Order_state =4 GROUP by order_id, Serivce_user_type, Service_user_name
Having COUNT (DISTINCT service_day) >1
) b on a.order_id = b.order_id and A.serivce_user_type =b.serivce_user_type and B.service_user_name =a.service_user_name W Here A.month = ' 2015-08 ';

Update Rpt_history_money_detail Set money_of_month = Customer_price_per_day * days_of_month;

UPDATE Rpt_history_money Set Customer_price_per_day =round (Customer_price_per_day, 2), Money_of_month =ROUND (money_of _month, 2)

Change financial statement data

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.