ORACLE 两表关联更新

时间:2021-11-30 13:29:01

-- update
update u_db_wx.wx_epp_userid t
set t.open_id_bl =
(select t2.open_id
from u_db_wx.wx_epp_user_ext_openid t2
where t2.user_id = t.user_id_epp)
where exists (select 1
from u_db_wx.wx_epp_user_ext_openid t2
where t2.user_id = t.user_id_epp);

-- 内联视图更新
update
(select t.open_id_bl, t2.open_id
from u_db_wx.wx_epp_userid t,u_db_wx.wx_epp_user_ext_openid t2
where t2.user_id = t.user_id_epp) t3
set t3.open_id_bl = t3.open_id;