1,使用top分页
select top 10 * from Orders a where a.orderid not in(select top 10 orderid from Orders order by orderid) order by a.orderid
2,使用row_number() 分页
select * from (select ROW_NUMBER() over(order by orderid) as rownumber,* from Orders) myresult where rownumber between 10 and 20
3,很明显使用top分页SQL语句执行时间比使用row_number() 分页执行SQL语句时间短,从而执行效率比较高。 |