如果有id(其他也可)唯一,则:
select top n-m+1 *
from t
where id not in (select top m - 1 id from t)如果没有,则:
1、
select top n-m+1 *
from
(select top n * from t order by id) a order by id desc
2、
select identity(int,1,1) id,* into #t from t
select top n-m+1 *
from t
where id not in (select top m - 1 id from t)
select top n-m+1 *
from t
where id not in (select top m - 1 id from t)如果没有,则:
1、
select top n-m+1 *
from
(select top n * from t order by id) a order by id desc
2、
select identity(int,1,1) id,* into #t from t
select top n-m+1 *
from t
where id not in (select top m - 1 id from t)
select *
from t
where rowid<n and rowid>m
(select top m * from tablename order by columnname) a
order by columnname desc