merge into ( select aa,bb,cc from table1) t1
using ( select aa,bb,cc from table2) t2
on (t1.aa=t2.aa)
WHEN MATCHED THEN
update set t1.bb=t2.bb;
本文介绍了一个 SQL Merge Into 的示例,展示了如何从 table2 更新 table1 中匹配的记录。当两个表中的 aa 字段相匹配时,将 table2 的 bb 字段值更新到 table1 的相应记录。
merge into ( select aa,bb,cc from table1) t1
using ( select aa,bb,cc from table2) t2
on (t1.aa=t2.aa)
WHEN MATCHED THEN
update set t1.bb=t2.bb;

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