sql 快速合并2个表
发布网友
发布时间:2022-05-12 22:59
我来回答
共1个回答
热心网友
时间:2023-10-28 19:51
2个sql:
insert into A(id,col1,col2)
select id,col1,col2
from b
where not exists(select 1 from A where A.id = B.id)
更新(sqlserver)
update A set A.col1 = B.col1,A.col2 = B.col2
from B
where A.id = B.id
更新(Oracle)
update A set (col1,col2) =
(select col1,col2 from Bwhere A.id = B.id
)
and exists(select 1 from A where A.id = B.id)