Commit 796c0fdf authored by 332784038@qq.com's avatar 332784038@qq.com

sql脚本更新

parent 9eb49abf
......@@ -116,14 +116,14 @@ ALTER TABLE `ecw_receipt_account` ADD COLUMN `collection_target_amount` DECIMAL(
ALTER TABLE `ecw_receipt_account` ADD COLUMN `collection_target_currency_code` varchar(255) DEFAULT NULL COMMENT '收款支付币种代码' AFTER `target_amount`;
UPDATE `ecw_receipt_account` r left join (SELECT
UPDATE `ecw_receipt_account` r join (SELECT
ra.id,
r1.source_amount,
r1.source_currency_code,
r1.target_amount,
r1.target_currency_code
FROM`ecw_receipt_account` as ra
left JOIN (SELECT rb.base_currency_id as base_currency_id, rb.receipt_id as receipt_id FROM `ecw_receivable` rb WHERE rb.receipt_id is not null GROUP BY rb.base_currency_id,rb.receipt_id) as rc
JOIN (SELECT rb.base_currency_id as base_currency_id, rb.receipt_id as receipt_id FROM `ecw_receivable` rb WHERE rb.receipt_id is not null GROUP BY rb.base_currency_id,rb.receipt_id) as rc
on rc.receipt_id = ra.receipt_id
JOIN `ecw_currency_rate` r1
ON ra.currency_id = r1.source_id
......@@ -138,15 +138,15 @@ UPDATE `ecw_receipt_account` r left join (SELECT
r.collection_target_amount = rs.target_amount,
r.collection_target_currency_code = rs.target_currency_code;
UPDATE `ecw_receipt_account` r left join (SELECT
UPDATE `ecw_receipt_account` r join (SELECT
ra.id
FROM `ecw_receipt_account` as ra
left JOIN (SELECT rb.base_currency_id as base_currency_id, rb.receipt_id as receipt_id FROM `ecw_receivable` rb WHERE rb.receipt_id is not null GROUP BY rb.base_currency_id,rb.receipt_id) as rc
JOIN (SELECT rb.base_currency_id as base_currency_id, rb.receipt_id as receipt_id FROM `ecw_receivable` rb WHERE rb.receipt_id is not null GROUP BY rb.base_currency_id,rb.receipt_id) as rc
on rc.receipt_id = ra.receipt_id
where ra.currency_id = rc.base_currency_id
) rs
on rs.id = r.id
left join `ecw_currency` c1 on r.currency_id = c1.id
join `ecw_currency` c1 on r.currency_id = c1.id
set r.source_amount = 1,
r.`source_currency_code` = c1.fuhao,
r.target_amount = 1,
......@@ -164,7 +164,7 @@ ALTER TABLE `ecw_receipt_item` ADD COLUMN `target_currency_code` varchar(255) DE
update `ecw_receipt_item` ri
left JOIN (
JOIN (
SELECT ra.currency_id as currency_id,
ra.receipt_id as receipt_id,
ra.source_amount as source_amount,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment