首页 > 代码库 > java之真假分页

java之真假分页

真分页(要的是什么范围的记录在数据库查的时候就只查这几条记录):
select s.* from (select *,row_number() over(order by SLoginId) as row_number from student) as swhere row_number between ? and ?
假分页(它至少要查你要的记录数以上的记录个数。你查5条可能查了几十条以后再在里面查你要的5条的):
模板select top rowsPerpage from table where id not in(select top (curPage-1)*rowsPerpage id from table)
例子:select top 5 * from student where sid not in(select top 5 sid from student) ----第二页

java之真假分页