oracle 多表更新问题
update customers a -- 使用别名
set city_name=(select b.city_name from tmp_cust_city b where b.customer_id=a.customer_id)
where exists (select 1
from tmp_cust_city b
where b.customer_id=a.customer_id
)
-- update 超过2个值
update customers a -- 使用别名
set (city_name,customer_type)=(select b.city_name,b.customer_type
from tmp_cust_city b
where b.customer_id=a.customer_id)
where exists (select 1
from tmp_cust_city b
where b.customer_id=a.customer_id
)
上面两段代码是在网上看到的,但是有些不明白,为什么在前面已经关联过一次b表,后面又要关联一次(红色部分)呢?
之前都是用的sql server ,oracle是初学,不是很懂,求教了.