多表关联的UPDATE语句书写语法1、单表update
update 表名 set 列名=新值 where条件;
select语句 for update;
2、两表(多表)关联update -- 仅在where字句中的连接
update table1 a -- 使⽤别名
pe='01' --update值
where exists (select 1
from table2 b,table3 c
where b.user_id=a.user_id
and b.user_id=c.userid
)
3、两表(多表)关联update -- 被修改值由另⼀个表运算⽽来
-- update单个值
update table1 a
set a.name=(select b.name from table2 b where b.id=a.id)update语法大全
where exists (select 1
from table2 b
where b.id=a.id
);
-- update多个值
update customers a -- 使⽤别名
set (name,type)=(select b.pe
from table2 b
where b.id=a.id)
where exists (select 1
from table2 b
where b.id=a.id
);