Commit 4efc94c3 by 周立明

sql修改

1 parent a1f4a168
......@@ -2,6 +2,11 @@
### 陈希 -----------------end---------------------
### 立明 -----------------start-------------------
update dj_car_life_online_statement_account_trade_detail a,dj_car_life_order_division od set a.division_flag=if(od.id is null,'N','Y'),a.shop_division_money=IFNULL(od.shop_division_money,0),fws_division_money=ifnull((
select sum(division_money) from dj_car_life_merchant_distribution md where md.deleted_flag='N' and rule_type=2 and division_order_code=od.division_order_code and target_merchant_type=2),0),
a.gl_division_money=ifnull(od.gl_division_money,0) + ifnull(od.djzhy_sub_merchant_division_money,0),a.division_date=od.division_date
where a.division_flag='N' and a.deleted_flag='N' and od.pay_order_id=a.pay_order_id and od.division_status=3 and od.deleted_flag='N';
update dj_car_life_online_statement_account_trade_detail a ,dj_car_life_order_division b
set a.reality_platform_merchant_id=b.reality_platform_merchant_id,a.reality_platform_merchant_name=b.reality_platform_merchant_name,
a.division_order_code=b.division_order_code
......@@ -48,7 +53,7 @@ insert into dj_car_life_online_statement_account_trade_distribution_detail(trade
select a.id,2,b.reality_merchant_id,b.reality_merchant_name, b.division_money,0,'system',NOW(),'system',now(),'N'
from dj_car_life_merchant_distribution b
join dj_car_life_online_statement_account_trade_detail a on a.division_order_code=b.division_order_code and a.deleted_flag='N'
where b.deleted_flag='N' and b.target_merchant_type=2 and b.division_money>0 and a.division_order_code is not null;
where b.deleted_flag='N' and b.target_merchant_type=2 and b.division_money>0 and a.division_order_code is not null and b.rule_type=2;
### 立明 -----------------end---------------------
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!