zoukankan      html  css  js  c++  java
  • Oracle 分页查询的一个实例

    1.分页模板

    select * from ( select rownum as rn , a.* from( 某个表名) a) where rn between 0 and 6

    2 某个表名

    select aa.title,aa.url,bb.times, bb.makedate from menu aa,
    (select count(*) times,title , max(id) id,max(makedate) makedate from menulog group by title order by count(*) desc ) bb where aa.id=bb.id

    3 将2 放入到1 中

    select * from ( select rownum as rn , a.* from( select aa.title,aa.url,bb.times, bb.makedate from menu aa,
    (select count(*) times,title , max(id) id,max(makedate) makedate from menulog group by title order by count(*) desc ) bb where aa.id=bb.id) a) where rn between 0 and 6

    ②另外一个实例

    select aa.title,aa.url,bb.times, bb.makedate,cc.title from menu aa,menu cc, (select count(*) times,title , max(id) id,max(makedate) makedate from menulog group by title order by count(*) desc ) bb where aa.id=bb.id and aa.pid =cc.id and aa.title like '%医疗账单录入清单%'

    select aa.title, aa.url, bb.times, bb.makedate, cc.title
      from menu aa,
           menu cc,
           (select count(*) times, title, max(id) id, max(makedate) makedate
              from menulog
             group by title
             order by count(*) desc) bb
     where aa.id = bb.id
       and aa.pid = cc.id
       and aa.title like '%医疗账单录入清单%'

    select *
      from (select rownum as rn, a.*
              from (select aa.title,
                           aa.url,
                           bb.times,
                           bb.makedate,
                           bb.maketime,
                           (select title from menu kk where kk.id = aa.pid) menulevelfouth
                      from menu aa,
                           (select count(*) times,
                                   title,
                                   max(id) id,
                                   max(makedate) makedate,
                                   max(maketime) maketime
                              from menulog
                             group by title
                             order by count(*) desc) bb
                     where aa.id = bb.id) a)
     where rn between 0 and 4


    select * from ( select rownum as rn , a.* from( select aa.title,aa.url,bb.times, bb.makedate ,cc.title from menu aa,
    (select count(*) times,title , max(id) id,max(makedate) makedate from menulog group by title order by count(*) desc ) bb where aa.id=bb.id and aa.pid =cc.id) a) where rn between 0 and 6

  • 相关阅读:
    Android监听器无法跳转的可能原因之一。。。
    627,一个神圣的日子
    Android BottomNavigationView的用法
    Android VideoView未解决,动态读取权限、BottomNavigationView的用法
    Android RecyclerView的补充。
    Android 的Glide、TabLayout、RecyclerView(下一章补充)。
    Android 自定义组件,自定义LinearLayout,ListView等样式的组件
    Android html5和Android之间的交互
    Android WebView的使用
    Android Json转换类对象,并使用
  • 原文地址:https://www.cnblogs.com/zytcomeon/p/13208042.html
Copyright © 2011-2022 走看看