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
據(jù)說這個速度快。
下面這個也可以:
-
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每頁顯示的行數(shù),
$offset = $perpage*($currentPage-1) 本文出自:億恩科技【mszdt.com】
服務器租用/服務器托管中國五強!虛擬主機域名注冊頂級提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM]
|