个人随笔
目录
Oracle用一个表的数据更新另一个表的方法
2023-06-26 10:18:07

Oracle用一个表的数据更新另一个表的方法,我们知道mysql是可以直接:update t1 ,t2 set t1.name=t2.name where t1.id=t2.id,但是oracle不能,oracle要用如下的方法

  1. update table1 t1 set t1.name=(select t2.name from table2 t2 where t1.id=t2.id) where t1.id in(select t2.id from table2 t2 where t1.id=t2.id)

注:where的目的是做限定,防止把table1中不存在table2表中的记录全部更新为null了,这个一定要特别注意。

 899

啊!这个可能是世界上最丑的留言输入框功能~


当然,也是最丑的留言列表

有疑问发邮件到 : suibibk@qq.com 侵权立删
Copyright : 个人随笔   备案号 : 粤ICP备18099399号-2