Re: [GENERAL] Simulating an outer join - Mailing list pgsql-general

From Bruce Momjian
Subject Re: [GENERAL] Simulating an outer join
Date
Msg-id 200001122345.SAA20709@candle.pha.pa.us
Whole thread Raw
In response to Re: [GENERAL] Simulating an outer join  (Julian Scarfe <jscarfe@callnetuk.com>)
List pgsql-general
> > UNION ALL
> > SELECT table1.key, NULL
> > FROM table1 WHERE NOT EXISTS
> > (SELECT table2.key FROM table2 WHERE table1.key = table2.key);
>
> FWIW, that's exactly Joe Celko's SQL-89 workaround for OUTER JOINs in 'SQL for
> Smarties'. Well in fact he uses (SELECT * FROM table2 WHERE table1.key =
> table2.key) as the subquery, but I presume that's an insignificant difference.

I am just writing the EXISTS section from my book.  I don't think it
matters what fields are returned from an EXISTS subquery.  If I am
wrong, someone please let me know.

--
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

pgsql-general by date:

Previous
From: Sarah Officer
Date:
Subject: triggers & functions
Next
From: Ed Loehr
Date:
Subject: Re: [GENERAL] triggers & functions