3

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
"FETCH FIRST n ROWS ONLY"
But I cannot figure out how to get rows from X to Y.
mySQL equivalent is LIMIT X, Y

Any ideas?

1 Answer 1

5

I found the solution:

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

Source

1
  • Nice! It has been very helpful.
    – user143101
    Jun 29, 2012 at 9:39

You must log in to answer this question.

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