Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2004
    Posts
    32

    Unanswered: Joining more than 2 tables

    Hi
    UDB 8.05.001

    I have 3 tables which I want to join as follows
    Table 1
    ColA ColB
    1 A
    2 B
    3 C


    Table 2
    Colc Cold
    2 X


    Table 3
    Cole Colf
    3 Z
    ----------------------------------------------
    I know to join two tables which is as follows
    select tb1.*, tb2.*
    from
    SESSION.table1 as tb1
    LEFT OUTER JOIN
    SESSION.table2 as tb2
    on
    tb1.colA = tb2.colc
    ----------------------------------------------
    Could anyone give me the syntax for 3 tables I tried couple of things but did
    not work.
    select tb1.*, tb2.*,tb3.*
    from
    SESSION.table1 as tb1
    LEFT OUTER JOIN
    SESSION.table2 as tb2
    on
    tb1.colA = tb2.colc

    I also want to include tb3 and join this on
    tb1.colA = tb3.cole



    Thanks

  2. #2
    Join Date
    Jun 2004
    Posts
    32

    I got it.

    I got the syntax.
    select tb1.*, tb2.*, tb3.*
    from
    SESSION.table1 as tb1
    LEFT OUTER JOIN
    SESSION.table2 as tb2
    on
    tb1.colA = tb2.colc
    LEFT OUTER JOIN
    SESSION.table3 as tb3
    on
    tb1.colA = tb3.cole

Posting Permissions

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