我有一张表
我进行如下查询时
select top 3 * from grades where classId not in (select top 6 classId from grades)结果是
排除前六条记录结果不应该是
我进行如下查询时
select top 3 * from grades where classId not in (select top 6 classId from grades)结果是
排除前六条记录结果不应该是
调试欢乐多
select top 3 * from grades where classId not in (select top 6 classId from grades)返回21345675,21345676,21345677
select top 3 * from grades where classId not in (select top 6 classId from grades order by ....) order by ...
前6条记录没了.就应该是我画圈圈的那3条阿 .
select top 3 * from grades where classId not in (select top 6 classId from grades)
我把这个6换成3它就是显示4,5,6那三条.
except
select top 6 * from grades
select top 3 * from grades
where classId
not in (select top 6 classId from grades order by 你选择前六的排序字段)
order by 你选择前三的排序字段--默认asc升序,desc 降序