读书人

oracle 分页sql话语

发布时间: 2012-10-25 10:58:57 作者: rapoo

oracle 分页sql语句

------------------------------比较好用--------------------------------------------------
select * from (select t.*,rownum as myrow
from (select e.*,rownum from v_wt2_chart e --order by pid 视图(view)使用后速度很慢
) t
where rownum <=60) where myrow>30

------------------------------视图的时候速度很慢-----------------------------------------
select * from
(select tt1.*,rownum rowno from (select * from V_WT2_CHART) tt1)
where rowno between 11 and 20


-------------------------只能用于table,view使用不了 ------------------------------------
select *
from (select rid
from (select rownum rn, rid
from (select rowid rid from b_wt2 o order by o.pid)
where rownum <= 20)
where rn >0) t1,
b_wt2 t2
where t2.rowid = t1.rid

读书人网 >SQL Server

热点推荐