merge into yyglbxq.curr a
using (select khh, mdlhh from cdktj.cktj where mdlhh = 'jt1' or mdlhh = 'JT1' or mdlhh = 'jt4' or mdlhh = 'JT4') b
on a.core_cust_id = b.khh
when matched then
update set a.belg_org_id = b.mdlhh
else
ignore;
using (select khh, mdlhh from cdktj.cktj where mdlhh = 'jt1' or mdlhh = 'JT1' or mdlhh = 'jt4' or mdlhh = 'JT4') b
on a.core_cust_id = b.khh
when matched then
update set a.belg_org_id = b.mdlhh
else
ignore;

本文介绍了一个使用SQL进行数据合并及更新的具体案例。该案例通过MERGE语句将来自不同表的数据整合并更新到目标表中,特别关注了当源表中的数据在目标表中有匹配项时如何进行更新操作。

7563

被折叠的 条评论
为什么被折叠?



