Introduction to three statement methods for joint modification of multiple tables in Oracle Database
1. The most efficient
Merge into user_member_info
USING (select min (UP. created) as cre, min (up. shop_no) as shop_no, up. memberid as memberid
From user_platform_relation up,
(Select memberid as mid, min (created) as cre
From user_platform_relation
Group by memberid) um
Where up. created = um. crere and up. memberid = um. mid
Group by up. memberid) B
ON (a. id = B. memberid
)
When matched then update set a. created = B. cre, a. shop_no = B. shop_no, a. modified_time = sysdate
Where a. shop_no is null;
2. Efficiency
Update (select ui. userid as uiuid, oi. user_id as oiuid,
Ui. id as uimid, oi. memberid as oimid,
Oi. modified_time as oitime
From user_member_info ui, reserveorder_info oi
Where ui. brandid = oi. brandid and ui. mobile = oi. telphone)
Set oiuid = uiuid, oimid = uimid;
3. The worst Efficiency
UPDATE RETURN_FACTORYORDER r SET (r. XSBILLDATE, r. DQ) = (
SELECT f. saletime, f. bezei from rf f WHERE r. BILL = f. BILL
)