日期:2014-05-17 浏览次数:20569 次
select *
from (
select *,rid = row_number() over (order by colname desc)
from tb
) temp
where rid between 10 and 15
order by rid
--SQL Server 2000
select top (5) *
from ( select top 15 * from 表 order by 排序列 desc ) as a
order by 排序列 desc
--SQL Server 2005,2008,2008R2,2012通用方法
select *
from (
select *,row_number() over (order by 排序列 desc) as id
from 表
) a
where id between 10 and 15
order by id
--SQL Server 2012
select * from 表 order by 排序列 desc OFFSET 10 ROW FETCH NEXT 5 ROWS ONLY