分页规律
方法1(最常用):
start:(pageIndex-1)*pageSize+1 end:pageIndex*pageSize
select * from (select *,row_number() over(order by Id desc) as rowIndex from tb_Person where RowIndex) as tb_new where rowIndex between (@pageIndex-1)*@pageSize+1 and @pageIndex*@pageSize
方法2(靠前面和后面的页面查询速度快)越过多少行 取多少行
select top(@pageSize)*
from tb_News where ID not exits in
select top (@pageIndex-1)*@pageSeze * from tb_News ;
新闻热点
疑难解答