Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2003
    Posts
    5

    Question Unanswered: DB2 v5 problems fetching only 1 row!

    Hello,
    since in DB2 v5 I cannot use "FETCH FIRST x ROWS ONLY", how can I limit the number of record extracted?

    I thought the follwing sql would work but sadly it extracts more than 1 record:

    SELECT COD_CLI_CEDENTE FROM AHLD.V_KEY_MIGR_SPIMI N1
    WHERE 1 < (SELECT COUNT(*)
    FROM AHLD.V_KEY_MIGR_SPIMI AS N2
    WHERE N1.COD_CLI_CEDENTE = N2.COD_CLI_CEDENTE)

    Please help. Thanks

    Marco

  2. #2
    Join Date
    Mar 2003
    Posts
    33

    Re: DB2 v5 problems fetching only 1 row!

    Can you use row_number() over() -function? Sorry, I cant't test it because I have a different version.


    Originally posted by M71
    Hello,
    since in DB2 v5 I cannot use "FETCH FIRST x ROWS ONLY", how can I limit the number of record extracted?

    I thought the follwing sql would work but sadly it extracts more than 1 record:

    SELECT COD_CLI_CEDENTE FROM AHLD.V_KEY_MIGR_SPIMI N1
    WHERE 1 < (SELECT COUNT(*)
    FROM AHLD.V_KEY_MIGR_SPIMI AS N2
    WHERE N1.COD_CLI_CEDENTE = N2.COD_CLI_CEDENTE)

    Please help. Thanks

    Marco
    -r-

  3. #3
    Join Date
    Mar 2003
    Posts
    5

    Re: DB2 v5 problems fetching only 1 row!

    Originally posted by raisa
    Can you use row_number() over() -function? Sorry, I cant't test it because I have a different version.
    No I cannot unfortunately. Thanks anyway.

Posting Permissions

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