oracle 中两个表,将一个表中的数据更新到另一个表中,其中a.cola = b.cola,请教SQL语句如何写:
发布网友
发布时间:2022-04-10 11:53
我来回答
共1个回答
热心网友
时间:2022-04-10 13:22
update temp a
set a.cola = (select b.cola from temp1 b where b.cola = a.cola and rownum=1),
a.cola1=(select count(c.cola) from temp1 c where c.cola = a.cola)
where exists ( select b.cola from temp1 b where b.cola = a.cola) and a.cola is not null
这样?