Thread: outer joins

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    Germany
    Posts
    9
    Rep Power
    0

    Question outer joins


    hello,

    i've tried to use "outer joins" with firebird, but it doesnt work correct. Firebird performed an inner join!

    SELECT field FROm Tabel1 LEFT JOIN Table2 ON Table1.Key = Table2.Key

    Table2 ist empty and the request returnd no rekords.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Oct 2003
    Location
    Germany
    Posts
    2,784
    Rep Power
    348
    Your example is an inner join!

    The syntax for an outer join is:
    Code:
    SELECT field 
    FROM Tabel1 
    LEFT OUTER JOIN Table2 ON Table1.Key = Table2.Key;
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    Germany
    Posts
    9
    Rep Power
    0

    Question outer joins


    Hello,

    I'm trying to use outer Joins on Firebird, but it seems not to work. My SQL-String was:

    SELECT AnyField FROM Table1 LEFT OUTER JOIN Table2 ON Table1.Key = Table2.Key

    IMPORTANT: Table2 is empty!

    Normaly i should get all Rekords from Table1 (if Table2 is empty).
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Oct 2003
    Location
    Germany
    Posts
    2,784
    Rep Power
    348
    Strange. Works for me...
  8. #5
  9. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Bucharest
    Posts
    72
    Rep Power
    12

    Question


    Originally posted by shammat
    Strange. Works for me...
    even strange, it doesn't work for me
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    Germany
    Posts
    9
    Rep Power
    0
    what can i do to get all rekords from "Table1" if "Table2" is empty. The Problem is, that i need to join the tablesbecause in "Table2" COULD be an Rekord. :-(
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    Germany
    Posts
    9
    Rep Power
    0
    I've found the problem! :-)

    I've tried the following:

    SELECT key from Table1 LEFT OUTER JOIN Table2 ON Table1.key = Table2.key

    This didn't work! But if i change it to the following, it works:

    SELECT Table1.key FROM Table1 LEFT OUTER JOIN Table2 ON Table1.key = Table2.key

    Thanks for helping me! :-)

IMN logo majestic logo threadwatch logo seochat tools logo