sql server 分页

int PageIndex  = 1;//当前第几页(从第一页开始)

int PageSize = 10;//每页大小

int ThisPage = (PageIndex -1)* 10 

1、not id  

select  top PageSize * from tableA where ispass = 1 and id not in (select top ThisPage id from tableA where ispass = 1)

2、row_number 函数

select top PageSize * from (select row_number() over(order by id asc) as rownumber,* from tableA WHERE spass = 1 ) temp_row where rownumber > ThisPage

3、fetch next 函数

SELECT * FROM tableA  WHERE ispass = 1 order by id ASC offset PageIndex  row fetch next PageSize rows only
原文地址:https://www.cnblogs.com/hkzw/p/14592150.html