oracle两表关联更新

来源:互联网 发布:淘宝卖土特产前景分析 编辑:程序博客网 时间:2024/05/22 23:46

带条件进行更新关联:

  update 表1 set 字段=
       (select 字段
          from 表2
         where 表2.user_fullname = 表1.VISITDOCTOR and  length(表1.visitdoctorcode) < 30
   and 表1.VISITDOCTORCODE = VISITDOCTOR and 表2.teamid=表1.Operunitcode)
 where
exists(
  select 1
    from 表2
   where 表2.user_fullname = 表1.VISITDOCTOR and length(表1.visitdoctorcode) < 30
   and 表1.VISITDOCTORCODE = VISITDOCTOR and 表2.teamid=表1.Operunitcode)

0 0
原创粉丝点击