oracle 分页

SELECT *
  FROM (SELECT A.*, ROWNUM RN
          FROM (select e.company_name,
                       e.company_id,
                       e.company_logo,
                       NVL(d.cnt, 0)
                  from ((select company_name, company_id, company_logo
                           from es_vote_company_info
                          where 1 = 1
                            and auditing = '2') e left join
                        (select count(1) cnt, t.company_id
                           from es_vote_company_record t
                          group by t.company_id
                          order by cnt) d on d.company_id = e.company_id)) A
         WHERE ROWNUM <= 9)
 WHERE RN > 0;


SELECT *
  FROM (SELECT A.*, ROWNUM RN
          FROM (select e.company_name,
                       e.company_id,
                       e.company_logo,
                       NVL(d.cnt, 0)
                  from ((select company_name, company_id, company_logo
                           from es_vote_company_info
                          where 1 = 1
                            and auditing = '2') e left join
                        (select count(1) cnt, t.company_id
                           from es_vote_company_record t
                          group by t.company_id
                          order by cnt) d on d.company_id = e.company_id)) A
         WHERE ROWNUM <= 18)
 WHERE RN > 9;

你可能感兴趣的:(oracle 分页)