适应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

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐