Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Im working with DB2 and I need to be able to return a limited set of results.
Ive figured out how to return the "TOP n" results with
But I cannot figure out how to get rows from X to Y.
mySQL equivalent is LIMIT X, Y

Any ideas?

share|improve this question
up vote 5 down vote accepted

I found the solution:

 SELECT ROW_NUMBER() OVER() AS rownum, myLargeTable.*
 FROM myLargeTable
) AS tmp
WHERE rownum > 200000 AND rownum <= 200005;


share|improve this answer
Nice! It has been very helpful. – user143101 Jun 29 '12 at 9:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .