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ù)說(shuō)這個(gè)速度快。
下面這個(gè)也可以:
-
Oracle分頁(yè)有通用寫(xiě)法,假設(shè)一頁(yè)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中分頁(yè)的寫(xiě)法:
select t.* from tbl_user t order by t.id limit $offset , $perpage
$currentPage = 1;//當(dāng)前頁(yè)碼
其中后面$offset指的是第幾頁(yè)開(kāi)始,$perpage每頁(yè)顯示的行數(shù),
$offset = $perpage*($currentPage-1) 本文出自:億恩科技【mszdt.com】
服務(wù)器租用/服務(wù)器托管中國(guó)五強(qiáng)!虛擬主機(jī)域名注冊(cè)頂級(jí)提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM]
|