当前位置:Gxlcms > 数据库问题 > Oracle多表关联如何更新多个字段

Oracle多表关联如何更新多个字段

时间:2021-07-01 10:21:17 帮助过:47人阅读

注意点:
1、被update主表一定要加上过滤条件。
2、查询出来更新结果集,同时也要作为被更新主表的条件,作为同步大家都是更新这部分数据。
update student stu
  set (stu.name,stu.sex) =
  (select bak.name,bak.sex
  from student_bak bak
  where bak.id = stu.id
  and stu.age = 20
  )
  where exists (select 1
  from student_bak bak
  where bak.id = stu.id
  and stu.age = 20
  )

Oracle多表关联如何更新多个字段

标签:sel   主表   from   oracle   多表关联   分数   rom   多个   update   

人气教程排行