update table1 set (table1.clumn1,table1.clumn2,...) --有几个写几个 = (select table2.clumn1,table2.clumn1,... --这里与上面字段对应即可 from table2 where table1.id = table2.id )
meger into table1 using table2 on (table1.id = table2.id) when matched then update set table1.clumn1 = table2.clumn1, table1.clumn2 = table2.clumn2 ......
update table1
set (table1.clumn1,table1.clumn2,...) --有几个写几个
=
(select table2.clumn1,table2.clumn1,... --这里与上面字段对应即可
from table2
where table1.id = table2.id
)
using table2
on (table1.id = table2.id)
when matched then
update set table1.clumn1 = table2.clumn1,
table1.clumn2 = table2.clumn2
......
但是最好在后面添加update的where的控制
防止不匹配的数据被更新为null