Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2009
    Posts
    2

    Unanswered: Join on 3 tables

    I would like to make a LEFT JOIN between table t1 and
    the result of a JOIN between t2 and t3.

    mathematically, I would write
    t1 LEFT JOIN ( t2 JOIN t3)

    In SQL, I only know how to make
    t1 LEFT JOIN t2 ... LEFT JOIN t3
    or
    t1 LEFT JOIN t2 ... JOIN t3

    But this doesn't give me the expected result.
    How could I do this
    t1 LEFT JOIN ( t2 JOIN t3)

    Thanks for your help

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Code:
    SELECT *
    FROM   t1
     LEFT
      JOIN (
            SELECT *
            FROM   t2
             INNER
              JOIN t3
                ON t3.field2 = t2.field2
           ) As an_alias
        ON an_alias.field1 = t1.field1
    George
    Home | Blog

  3. #3
    Join Date
    Oct 2009
    Posts
    2

    Thanks

    Thanks George. This works fine.

Posting Permissions

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