例如
简化案例表:
select count(1) from table_a; --> returns 5 results
select count(1) from table_b; --> returns 4 results
select count(1) from table_a, table_b2 b
where b.id_ab like a.id_ab; --> returns 4 results
select count(1) from table_a, table_b2 b
where b.id_ab not like a.id_ab; --> returns unexpected result
SQL:
试过这个(除了)但遇到错误。
select a.id_ab from table_a a, table_b b except select a.id_ab from table_a, table_b2 b
where b.id_ab not like a.id_ab;
或者如何使用联合来做到这一点?例如
(Select * from table_a except select * from table_b) Union All (Select * from table_b except select record_id from table_a);
预期结果:
谢谢你。