两个表a,b 根据a,b两表的客户ID号去更新a表中的客户的城市名称,具体写法如下:
update table_name 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)
两个表a,b 根据a,b两表的客户ID号去更新a表中的客户的城市名称,具体写法如下:
update table_name 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)