两种分布方式,个人习惯,你自己取舍吧:
定义:
当前页面是page,每页条目数是nums
1.top 方式
select top nums from * from talbe where id not in (select top (page-1)*nums from table order by id) order by id
2.row_number方式
select * from
(select *,ROW_NUMBER() over (order by id ) as 行号 from table) as t
where t.行号 between page*(num-1)+1 and page*num