SQL question - IBM AS400

This is a discussion on SQL question - IBM AS400 ; I have a query where I am joining 3 files. One of which I only need to access the first record which matches the join by key from file 1. Does anyone know how I can accomplish this? If I ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: SQL question

  1. SQL question

    I have a query where I am joining 3 files. One of which I only need to
    access the first record which matches the join by key from file 1.

    Does anyone know how I can accomplish this? If I do inner join or right
    join, I get all the matching records, when I only want the first
    record that matches file 1 from file 3.

    --
    Posted via a free Usenet account from http://www.teranews.com


  2. Re: SQL question

    On Jun 14, 5:19 pm, Thomas Hauber wrote:
    > I have a query where I am joining 3 files. One of which I only need to
    > access the first record which matches the join by key from file 1.
    >
    > Does anyone know how I can accomplish this? If I do inner join or right
    > join, I get all the matching records, when I only want the first
    > record that matches file 1 from file 3.
    >
    > --
    > Posted via a free Usenet account fromhttp://www.teranews.com


    Instead of join can you use where exists? That way the records 'join'
    if there are 1 or more matches & dont 'join' if there are none.

    Jonathan


+ Reply to Thread