How to add offset in a “select” query in Oracle 11g?

后端 未结 3 719
一整个雨季
一整个雨季 2020-12-06 06:22

How to add an offset in a \"select\" query in Oracle 11g. I only know how to add the limit by e.g rownum <= 5 this question is not a duplicate, I already che

3条回答
  •  感动是毒
    2020-12-06 06:51

    You can use ROW_NUMBER function for that.

    Maybe this helps:

    SELECT *
      FROM(SELECT t.*,
                  ROW_NUMBER() OVER (ORDER BY ...) rn -- whatever ordering you want
             FROM your_table t
          )
     WHERE rn >= ... -- your offset
    

    Hope that helps

提交回复
热议问题