Thread

  1. Antw: Outer Joins

    Gerhard Dieringer <dieringg@eba-haus.de> — 2000-11-02T07:55:53Z

    >>> "Marc Rohloff" <Marc.Rohloff@eskom.co.za> 01.11.2000  09.02 Uhr >>>
    >
    > select a.col1, b.col2 from a,b 
    > where a.col1 = b.col2
    >   or  b.col2 is null
    >
    
    This query has nothing to do with an outer join. See the following example:
    
    table a
    
    c1
    ---
    x
    y 
    
    and 
    
    table b
    
    c2
    ---
    x
    
    Then an outer join gives:
    
    select a,c1, b.c2
    from a left outer join b on a.c1 = b.c2
    
    c1 | c2
    x  |  x
    y  | (null)
    
    but your query gives:
    
    select a.c1, b.c2
    from a, b 
    where a.c1 = b.c2
      or  b.c2 is null
    
    c1 | c2
    x  |  x
    
    because there are no rows in table b with c2 is null
    
    -------------
    Gerhard