用sqlserver 的分页语句,能查出rownum给页面单独显示.是有序的.或者别的方式写的分页也行,

只要能分页并且得到行号就行 或者别的方式写的分页也行,
2025-01-01 11:01:18
推荐回答(1个)
回答1:

两种分布方式,个人习惯,你自己取舍吧:
定义:
当前页面是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