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?

madmaze
  • 4,444

1 Answers1

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

madmaze
  • 4,444