If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > pagination

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-22-04, 19:45
tpass001 tpass001 is offline
Registered User
 
Join Date: Jun 2004
Posts: 3
pagination

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.

V.
Reply With Quote
  #2 (permalink)  
Old 06-23-04, 04:35
brat4 brat4 is offline
Registered User
 
Join Date: Apr 2003
Location: Singapore
Posts: 59
hi,

SELECT * FROM (SELECT firstNAME, rownumber() OVER (ORDER BY firstNAME) AS rn FROM user) AS tr WHERE rn BETWEEN 11 and 20

Hope it helps...
p.nee “OLAP Functions in the SQL Reference” for fancy stuff like rownum and rank

Cheers
brat.
Reply With Quote
  #3 (permalink)  
Old 06-24-04, 09:26
tpass001 tpass001 is offline
Registered User
 
Join Date: Jun 2004
Posts: 3
Does not work on z/os

Hi,

The query you suggested works on db2 on pc but not on db2 7.1.1 on z/os. any ideas?

Thanks.
Reply With Quote
  #4 (permalink)  
Old 06-24-04, 12:47
brat4 brat4 is offline
Registered User
 
Join Date: Apr 2003
Location: Singapore
Posts: 59
sorry dude not into z/os but the following link may give u some insight

http://www.idugdb2-l.org/adminscript...&F=&S=&P=15547

sorry to know that this link also ends in a dead end... If (only if) i do find somthing ' else i'll post it here.. check this thread in the next 24 hrs

cheers
brat
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On