select DATA FROM THE SIXTH TO TENTH(ORACLE)

ORACLE SQL 分页取6~10条数据

 

/*失败版本*/

/*get data (from the sixth to the tenth*/
select T.*
  from (select b.*, ROWNUM
          from (select *
                  from T_JOB
                 where company_cd = 'S'
                   AND BRANCH_CD = 'T'
                 ORDER BY JOB_NO) b
         where ROWNUM<= 10) T
WHERE ROWNUM >5

 

 

/*成功版本*/

/*get data (from the sixth to the tenth*/
select T.*
  from (select b.*, ROWNUM AS MYROW
          from (select *
                  from T_JOB
                 where company_cd = 'S'
                   AND BRANCH_CD = 'T'
                 ORDER BY JOB_NO) b
         where ROWNUM <= 10) T
 WHERE MYROW > 5

 

 

你可能感兴趣的:(select DATA FROM THE SIXTH TO TENTH(ORACLE))