Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004

    Unanswered: 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.

  2. #2
    Join Date
    Mar 2004
    select * from (
    select COLUMN_1, COLUMN_2, row_number() over(order by COLUMN_2) as ROW from YOUR_TABLE )
    as LISTING where ROW <= 25

  3. #3
    Join Date
    Apr 2004

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts