0

i've a little "big" issue with a query that use ROWNUM.

The query is:

SELECT * FROM (
   SELECT b.* FROM BANANA b 
   ORDER BY b.CREATION_DATE DESC, b.TYPE DESC) 
WHERE ROWNUM BETWEEN n AND m;

for n=0 and m=20 this query returns 20 elems (from ROWNUM 1 to 20)

but for n=10 and m=20 this query returns 0 rows.

Why? What's wrong with me and this query? Ty for your patient

PS: i want only 1 subquery.

Lalit Kumar B
  • 47,486
  • 13
  • 97
  • 124
Innet
  • 459
  • 3
  • 5
  • 18
  • 1
    You can also look at [this](http://stackoverflow.com/q/855422/266304) or [this](http://stackoverflow.com/q/470542/266304) for more information. [This Tom Kyte article](http://www.oracle.com/technetwork/issue-archive/2006/06-sep/o56asktom-086197.html) goes into even more detail. – Alex Poole Feb 02 '16 at 10:51
  • See [**How ROWNUM works in pagination query?**](http://stackoverflow.com/questions/30321483/how-rownum-works-in-pagination-query/30321788#30321788) – Lalit Kumar B Feb 02 '16 at 10:58
  • Thanks for the response and sorry for the duplicate :) – Innet Feb 02 '16 at 11:00

0 Answers0