Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

I found the solution:

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

Source

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.