欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

Oracle中操作分页

程序员文章站 2022-06-12 14:36:01
...

mysql中分页的写法:select t.* from tbl_user t order by t.id limit $offset , $perpage$currentPage = 1;//当前页码其中后面$

sql:

with partdata as (select rownum rowno,t.* from tablename t where column='1090'order by column) select * from partdata where rowno between 0 and 50

据说这个速度快。

下面这个也可以:

Oracle分页有通用写法,假设一页5行
select * from (
select t.*,rownum from (
select * from table1 where condition order by column) t )
where rownum>(pangeNow-1)*5 and rownum

如果基础查询不需要排序,可以省掉一层嵌套
select * from (
select t.*,rownum from table1 t where condition )
where rownum>(pangeNow-1)*5 and rownum
mysql中分页的写法:
select t.* from tbl_user t order by t.id limit $offset , $perpage
$currentPage = 1;//当前页码
其中后面$offset指的是第几页开始,,$perpage每页显示的行数,
$offset = $perpage*($currentPage-1)

Oracle中操作分页