SELECT TOP 页大小 *
FROM table1
WHERE id NOT IN
(
SELECT TOP 页大小*(页数-1) id FROM table1 ORDER BY id
)
ORDER BY id
select top 10 * from 表名--查询显示0-10条记录(10条)
select top 10 *from 表名 where 主键 not in(select top 10 表名 from 主键);--查询显示11-20条记录(10条)
select top 10* from表名 where 主键not in (select top 20 表名 from 主键);--查询显示21-30条记录(10条)
select top 10* from表名 where 主键not in (select top 30表名 from 主键);--查询显示31-40条记录(10条)
例如:
select top (@pageSize) * from books where id not in
(select top ((@pageIndex-1)*@pageSize) id from books order by id) order by id