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ù)說這個(gè)速度快。
下面這個(gè)也可以:
-
Oracle分頁有通用寫法,假設(shè)一頁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
如果基礎(chǔ)查詢不需要排序,可以省掉一層嵌套
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;//當(dāng)前頁碼
其中后面$offset指的是第幾頁開始,$perpage每頁顯示的行數(shù),
$offset = $perpage*($currentPage-1) 本文出自:億恩科技【1tcdy.com】
服務(wù)器租用/服務(wù)器托管中國五強(qiáng)!虛擬主機(jī)域名注冊(cè)頂級(jí)提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM]
|