MYSQL分页公式
(当前页数-1) * 每页条数,每页条数
SELECT * FROM TABLE LIMIT (Page - 1) * PageSize, PageSize ;
SQLSERVER
(row_number()over(order by))
该关键字只有在SQL server 2005版本以上才有
-- 分页查询公式-row_number()-优化版本 select * from ( -- rownumber是别名,可按自己习惯取 select top (Page*PageSize) row_number() over(order by 主键 asc) as rownumber,* from 表名) temp_row where rownumber>((Page-1)*PageSize);
ORCLE
SELECT * FROM ( SELECT ROWNUM r, tab.* FROM tab_name tab WHERE ROWNUM <= pageSize * Page ) temp WHERE r > pageSize * Page - pageSize; SELECT * FROM ( SELECT ROWNUM rn, temp.* FROM ( SELECT * FROM tab_name tab ORDER BY tab.pk_column DESC) temp WHERE ROWNUM < end_num) WHERE rn > start_num;
标签:分页,PageSize,数据库,查询,tab,ROWNUM,Page,SELECT,row From: https://www.cnblogs.com/jiangge23/p/16955248.html