pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gerhard Dieringer <DieringG@eba-haus.de>
To: Marc.Rohloff@eskom.co.za
Cc: pgsql-sql@postgresql.org
Subject: Antw: Outer Joins
Date: Thu, 02 Nov 2000 08:55:53 +0100
Message-ID: <sa012c39.092@kopo001> (raw)

>>> "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





Message-ID: <sa012c39.092@kopo001>
Permalink:  ../sa012c39.092@kopo001/
Also on:    postgresql.org/message-id/sa012c39.092@kopo001

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: DieringG@eba-haus.de, Marc.Rohloff@eskom.co.za
  Subject: Re: Outer Joins
  In-Reply-To: <sa012c39.092@kopo001>
  References: <sa012c39.092@kopo001>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox