假设你数据库有个A表:
ID NAME
1 aaa 2 bbb 3 ccc 4 ddd 需求:给你几个ID,返回A表中不存在的ID? 例如提交1,2,8,9 返回8,9
select B.id from (select 1 as id from dual union select 2 as id from dual union select 8 as id from dual union select 9 as id from dual) Bleft join Aon A.id = B.idwhere A.id is null;