Antw: Outer Joins

From: "Gerhard Dieringer" <DieringG(at)eba-haus(dot)de>
To: <Marc(dot)Rohloff(at)eskom(dot)co(dot)za>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Antw: Outer Joins
Date: 2000-11-02 07:55:53
Message-ID: sa012c39.092@kopo001
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

>>> "Marc Rohloff" <Marc(dot)Rohloff(at)eskom(dot)co(dot)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

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2000-11-02 08:09:10 Re: [SQL] Re: Problem with coalesce..
Previous Message Marc Rohloff 2000-11-02 07:11:50 Re: Outer Joins