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 > Limiting rows before doing join

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-05-04, 16:59
cruza cruza is offline
Registered User
 
Join Date: Apr 2004
Posts: 2
Limiting rows before doing join

Does anyone know of a way to limit the number of rows in a select from one table before doing a join to another table.

I have a table with 50K+ records in it that I need to do a join to another table. I want to process 25 records at a time and don't want to materialize the entire recordset before doing a "FETCH FIRST 25 ROWS ONLY". I would like to get 25 rows and then join that select to the second table.

Thanks for any suggestions.
Reply With Quote
  #2 (permalink)  
Old 04-06-04, 02:11
Charisma11 Charisma11 is offline
Registered User
 
Join Date: Mar 2004
Posts: 4
select * from (
select COLUMN_1, COLUMN_2, row_number() over(order by COLUMN_2) as ROW from YOUR_TABLE )
as LISTING where ROW <= 25
Reply With Quote
  #3 (permalink)  
Old 04-06-04, 08:46
cruza cruza is offline
Registered User
 
Join Date: Apr 2004
Posts: 2
Limiting rows before doing join

Sorry... I am pretty new to this I should have stated the following.

We are using version 7 on OS/390. I tried what you stated with no luck. I did some research, and it seams the row_number() function is not suppported.

Please let me know if I am wrong, or if there is another way.

Thanks again.
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