oracle - update rows from multiple tables -


i have 2 tables affiliation , customer, in have data

aff_id  from_cus_id ------  ----------- 1       10 2       20 3       30 4       40 5       50   cust_id   cust_aff_id  -------   ------- 10 20 30 40 50 

i need update data cust_aff_id column affiliation table aff_id below

cust_id   cust_aff_id  -------   ------- 10        1 20        2 30        3 40        4 50        5 

could u please give reply if knows......

merge customer t2    using affiliation t1  on (t1.from_cus_id =t2.cust_id )   when matched   update set t2.cust_aff_id  = t1.aff_id   ; 

Comments