适应oracle

update 表A
set (表A.字段1,表A.字段2) =
(
select 表B.字段1,表B.字段2 from 表B where 表A.字段3=表B.字段3
)

完整一点最好判断下是否存在 exists (select 1 from b where table1.c3=table2.a3)

update table1
set (table1.c1,table1.c2) =
(
select table2.a1,table2.a2
from table2
where table1.c3=table2.a3
and exists (select 1 from b where table1.c3=table2.a3)
)

适应mysql
update 表A,表B
set 表A.字段2=表B.字段4
where 表A.字段1=表B.字段3

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐