27,580
社区成员
发帖
与我相关
我的任务
分享
取n到m行
select top m * from tablename where id not in (select top n id from tablename order by id asc/*|desc*/)
--2005
select * from
(
select rowid=row_number() over(order by id desc),* from tb
) as t
where rowid=2select top 1 * from(select top 2 * from [tb] order by id desc) t order by id按id排序.
select top 1 * from tb as a
where id < (select max(id) from tb)
order by id desc;
--2005使用row_number() over()
select *
from(select rowid=row_number() over(order by id desc),* from tb) as a
where rowid=2