Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pagination

Status
Not open for further replies.

tpass001

Programmer
May 30, 2003
6
US
select * from ( select a.*, rownum rnum from (select job, empno from emp order job asc) a )where rnum>=5 and rnum<7

This is query used to retrieve rows 2 rows, i.e., the 5th and 6th rows from the complete query run above. Of course, this is in oracle, but is there a way to do this using db2?

Please let me know, I have been looking for this for a while now.

Thanks.
 
You can use OLAP functions to achieve the same effect:

select * from
(select empno, job, rownumber() over (order by job asc) as rown
from emp) emp2
where rown between 5 and 7
 
This query works on DB2 on pc but not on DB2 7.1 on z/os. Any ideas?

T,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top