欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

SQL/Oracle 两表关联更新

程序员文章站 2022-03-07 13:54:06
...
update info_1 a set (a.cname,a.ename) = (select b.cname,b.ename from info_2 b where b.code = a.code and rownum = 1)
where substr(a.code, 1, 2) = '11' and exists (select 1 from info_2 b where b.code = a.code)