plsql多表联查update

 1 update customers a -- 使用别名
 2 set city_name=(select b.city_name from tmp_cust_city b where b.customer_id=a.customer_id)
 3 where exists (select 1
 4 from tmp_cust_city b
 5 where b.customer_id=a.customer_id
 6 )
 7 -- update 超过2个值
 8 update customers a -- 使用别名
 9 set (city_name,customer_type)=(select b.city_name,b.customer_type
10 from tmp_cust_city b
11 where b.customer_id=a.customer_id)
12 where exists (select 1
13 from tmp_cust_city b
14 where b.customer_id=a.customer_id
15 )

 

转载于:https://www.cnblogs.com/dawen0528/p/11120525.html

你可能感兴趣的:(plsql多表联查update)