Home Mybatis分页计算公式
Post
Cancel

Mybatis分页计算公式

MySQL

1
2
-- n为页码,m为每页数据条数
select * from table_name limit (n-1)*m, m

Oracle

1
2
3
4
5
-- n为页码,m为每页数据条数
select a.* from (
  select b.*,rownum as rn from table_name b
) a
where a.rn between (n-1)*m+1 and n*m  
This post is licensed under CC BY 4.0 by the author.