查询数据在表A中存在,但是在表B中不存在的方法
- 使用left join … on …
select * from A left join B on A.dp_account = B.dp_account where B.dp_account is null;
- 使用not in
select distinct A.dp_account from A where A.dp_account not in (select dp_account from B)
select * from B where (select count(1) as num from A where A.dp_account = B.dp_account ) = 0