INSERT INTO C (列表....) SELECT 列表 from a where id not in(select id from b)
insert into C select A.* from A left join B on a.id=b.id where b.id is null
insert into c select a.* from a where a.id not in (select id from b)根据你的意思应该是这样!
你的问题 标题说 表b中没有,问题内容描述 又说 表b中有; //b没有 insert into c select * from a where id not in (select id from b)//b有 insert into c select * from a where id in (select id from b)
select A.* from A left join B on a.id=b.id
where b.id is null
insert into c select a.* from a where a.id not in (select id from b)根据你的意思应该是这样!
//b没有
insert into c select * from a where id not in (select id from b)//b有
insert into c select * from a where id in (select id from b)