对于一万个学号(XH)为A00001~A10000的学生,
想要知道在数据库的某个表(例如表stu)中,
这一万个学号中,有哪些是在stu表中查不到的。
除了建临时表,有没有什么简便快捷的方法?
1.左右关联用过吧, 1w学号的存储表 tab_1wxh, 待匹配表 tab_stu ,两表之间通过xh 字段左关联
select * from
tab_1wxh t1
left join tab_stu t2 on t1.xh = t2.xh
where t2.xh is null
select * from a where xh not in (select xh from b)
select * from xh where xh not in (select xh from stu);
把表stu的学号数据导出来,然后假设sheet1的a列是10000个学号,sheet2的a列是导出stu的学号,在sheet1的b列第一行输入=VLOOKUP(A1,Sheet2!A:A,1,FALSE),点击单元格右下角加号,c列第一行输入=if(a1==b1,1,0),点击单元格右下角加号,然后筛选c列为1的就是有的,为0的就是没有的