oracle update多表关联查询更新

--假设我要更新tableA表的emp_id和tableB表的emp_id,条件是tableA的emp_id和tableB的emp_no相等,那么写法如下
update tableA a
set a.emp_id = (select b.emp_id from tableB b where b.emp_no= a.emp_id)
where exists (select 1 from tableB b where b.emp_no = a.emp_id)

 

posted on 2023-09-01 15:54  炼金师  阅读(45)  评论(0编辑  收藏  举报

导航