Quantcast
Channel: How do I limit the number of rows returned by an Oracle query after ordering? - Stack Overflow
Viewing all articles
Browse latest Browse all 17

Answer by Leigh Riffel for How do I limit the number of rows returned by an Oracle query after ordering?

$
0
0

An analytic solution with only one nested query:

SELECT * FROM(   SELECT t.*, Row_Number() OVER (ORDER BY name) MyRow FROM sometable t) WHERE MyRow BETWEEN 10 AND 20;

Rank() could be substituted for Row_Number() but might return more records than you are expecting if there are duplicate values for name.


Viewing all articles
Browse latest Browse all 17

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>