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