1)最简单的形式
update customers a //使用别名
set customer_type='01' //01 为vip,00为普通
where exists (select 1 from tmp_cust_city b where b.customer_id=a.customer_id)
2)两表(多表)关联update,被修改值由另一个表运算而来
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)
3) 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 1from tmp_cust_city b where b.customer_id=a.customer_id)