From: Herouth Maoz <herouth@oumail.openu.ac.il>
To: Ant9000 <ant9000@seldati.it>
To: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] OUTER JOINs in PostgreSQL
Date: Sun, 6 Jun 1999 15:06:14 +0300
Message-ID: <l03130303b380144a99e0@[147.233.159.109]> (raw)
In-Reply-To: <99060222482601.00588@chomp>
At 23:47 +0300 on 02/06/1999, Ant9000 wrote:
> The best I was able to obtain is this:
>
> SELECT master.*,detail.lastvisit,detail.info FROM master,detail
> WHERE master.id=detail.id
> UNION
> SELECT *,NULL AS lastvisit,NULL AS info FROM master
> WHERE id NOT IN (SELECT id FROM detail);
>
> which is (at best) unelegant; in MS Access you could do something like
>
> SELECT master.*,detail.lastvisit,detail.info FROM master LEFT JOIN detail
> ON master.id=detail.id;
>
> With Oracle, there's an even shorter solution:
>
> SELECT master.*,detail.lastvisit,detail.info FROM master,detail
> WHERE master.id=detail.id(+);
>
>
> Is anything like that available with PostgreSQL?
No, outer joins are not supported in PostgreSQL. Your solution is the
accepted workaround, although I tend to recommend WHERE NOT EXISTS ( select
* from detail WHERE detail.id = master.id )in the second clause - it is
more efficient.
Herouth
--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma
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: herouth@oumail.openu.ac.il, ant9000@seldati.it
Subject: Re: [SQL] OUTER JOINs in PostgreSQL
In-Reply-To: <l03130303b380144a99e0@[147.233.159.109]>
References: <99060222482601.00588@chomp> <l03130303b380144a99e0@[147.233.159.109]>
* 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