Oracle- 分页例子

  Oracle分页的写法,比MSSQLSERVER还简单。

  记录如下:

select t.*, rownum r
        from (select su02,
                     wi00,
                     wi01,
                     wi02,
                     wi05,
                     to_char(wi08, 'yyyy-mm-dd') rq,
                     ROUND(TO_NUMBER(nvl(wi11, (select sysdate from dual)) - wi08) * 24) hours
                from WF_TASK
                LEFT JOIN SYS_USERS
                  ON WT07 = SU00
                left join VW_wf_infor
                  on wi01 = wt00
               where 1 = 1
                 and wt07 in
                     (select su00
                        from FE_BASE5.GROUP_USER_V
                       where SG04 like '宏杰集团/广东宏杰内衣实业有限公司/浪漫%')
                 and wi01 in (select distinct wi01
                                from WF_INFOR
                               where wi13 not in ('3', '4')) and 1 = 1
               order by wi01 desc) t
       where rownum <= 15*1 and rownum>=15*(1-1)

   rownum <= 15*1 and rownum>=15*(1-1)对应ronum<=rows*page and rownum>=rows*(page-1);

posted @ 2015-04-16 13:48  春天又来了  阅读(469)  评论(0编辑  收藏  举报