Re: Several left outer joins on a same table

From: Aaron Mulder <ammulder(at)alumni(dot)princeton(dot)edu>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Several left outer joins on a same table
Date: 2002-07-23 12:10:04
Message-ID: Pine.LNX.4.44.0207230806120.29067-100000@gentoo.CS.Princeton.EDU
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Try something like:

select l1.lieu_nom, l2.lieu_num
from Personne p left outer join Lieu l1 on lieu_id=lieu1
left outer join Lieu l2 on lieu_id=lieu2

Aaron

On Tue, 23 Jul 2002, Th Templ wrote:
> Here are my tables
>
> Personne
> ------------
> int lieu1
> int lieu2
>
> Lieu
> ------------
> int lieu_id
> varchar(50) lieu_nom
>
> I want to have in a single request the name of lieu1 and/or lieu2 in the
> 'Lieu' table if there is a correspondance and if there are not null.
> I see the postgresql documentation and I have no problem to make one left
> outer join, but two??
>
> Thans for your answers
> Templ
>
> _________________________________________________________________
> Join the world’s largest e-mail service with MSN Hotmail.
> http://www.hotmail.com
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Amel Mammar 2002-07-23 14:07:54 Postgres JDBC
Previous Message Dave Cramer 2002-07-23 09:51:05 Re: Several left outer joins on a same table