将数据插入表中 C, 如果数据不在表中 B 与表相比 A?

我有 2 我想要比较数据并插入差异 3 yu表我有


table A

number Status
1111 C
2222 O
3333 O
4444 C


Table B

number status
1111 c
2222 O
5555 C
6666 O


现在我想从表A插入数据,这些数据不是在表中的,即 3333 和 4444

我有这样的要求


Insert into Table C /number,Status/
Select a.number,a.Status from Table A a
left join Table B b ON b.number = a.number
where B.number is Null


但它插入了数据 Null 在表格中 C
已邀请:

喜特乐

赞同来自:

我检查了我的逻辑并发布了结果


insert into tableC /number, status/
select * from tableA
Except
select * from tableb

要回复问题请先登录注册