当前位置:Gxlcms > mysql > Oracle中操作分页

Oracle中操作分页

时间:2021-07-01 10:21:17 帮助过:25人阅读

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<=(pageNow)*5

如果基础查询不需要排序,可以省掉一层嵌套
select * from (
select t.*,rownum from table1 t where condition )
where rownum>(pangeNow-1)*5 and rownum<=(pageNow)*5

mysql中分页的写法:
select t.* from tbl_user t order by t.id limit $offset , $perpage
$currentPage = 1;//当前页码
其中后面$offset指的是第几页开始,,$perpage每页显示的行数,
$offset = $perpage*($currentPage-1)

linux

人气教程排行