sql 一个表中数据 插入另一个表中 如果没有

2025年03月23日 13:46
有1个网友回答
网友(1):

表1
create table table1
(
id int not null,
name varchar(50)
)
create table table2
(
id int not null,
name varchar(50)
)
insert into table1
select id,name from table1
where not exists(select 1 from table2 where table1.id = table2.id)