關于兩表關聯的update,可以把SQL寫成了在SQL Server下面的特有形式,但是這種文法在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)
-
資料引用:http://www.knowsky.com/347147.html