[ 来源:http://www.it55.com | 作者: | 时间:2007-09-16 | 收藏 | 推荐 ] 【大 中 小】
更新update多个关联表的SQL写法:
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
(编辑:IT资讯之家 www.it55.com)