if object_id('ta')>0 drop table tacreate table ta(A int identity(1,1),B varchar(8))insert into ta select 'A1' union all select 'A2' union all select 'A3' union all select 'A4' union all select 'A5' union all select 'A6' union all select 'A7' union all select 'A8' union all select 'A9' union all select 'A10' union all select 'A11' union all select 'A12' union all select 'A13' union all select 'A14' union all select 'A15' union all select 'A16'select top 3 * from ta a where a.A not in(select top 9 A from ta B order by B.A) order by a.A--***结果 /* A B ----------- -------- 10 A10 11 A11 12 A12 */drop table ta
select 'A1' union all select 'A2' union all select 'A3' union all select 'A4'
union all select 'A5' union all select 'A6' union all select 'A7' union all select 'A8'
union all select 'A9' union all select 'A10' union all select 'A11' union all select 'A12'
union all select 'A13' union all select 'A14' union all select 'A15' union all select 'A16'select top 3 * from ta a where a.A not in(select top 9 A from ta B order by B.A) order by a.A--***结果
/*
A B
----------- --------
10 A10
11 A11
12 A12
*/drop table ta