SqlServer 简单的分页查询小白适用

--A:数据条数  B:页码 

select top A * from Table
where uid not in(select top ((B-1)*A) uid from Table)

列如:

每页显示5条数据 第一页查询语句如下

select top 5 * from adminInfo
where uid not in(select top ((1-1)*5) uid from adminInfo)

第二页

select top 5 * from adminInfo
where uid not in(select top ((2-1)*5) uid from adminInfo)

猜你喜欢

转载自blog.csdn.net/qq_36729112/article/details/88944113