oracle 用一个表的数据去更新另外一个表的数据

来源:互联网 发布:常用数据处理软件 编辑:程序博客网 时间:2024/05/16 03:14

去掉 有重复数据的 情况

 

 merge into acl_user p
    using (select * from testimportuser X where X.ROWID=(select max(Y.ROWID) from testimportuser Y where X.yhdm=Y.yhdm ) ) np
    on (p.yhdm=np.yhdm)
    when matched then
    update set p.sfzmhm=np.sfzhm
    when not matched then insert(p.yhdm,p.xm,p.sfzmhm,p.cjsj)values(np.yhdm,np.xm,np.sfzhm,sysdate)

0 0
原创粉丝点击