Antw: Outer Joins - Mailing list pgsql-sql

From Gerhard Dieringer
Subject Antw: Outer Joins
Date
Msg-id sa012c39.092@kopo001
Whole thread Raw
List pgsql-sql
>>> "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




pgsql-sql by date:

Previous
From: "Marc Rohloff"
Date:
Subject: Re: Outer Joins
Next
From: Tom Lane
Date:
Subject: Re: Re: [GENERAL] Problem with coalesce..