pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Constantin Teodorescu <teo@flex.ro>
Cc: PostgreSQL Interfaces <pgsql-interfaces@postgresql.org>
Subject: Re: MULTIPLE OUTER JOIN SYNTAX :-( can't quess it
Date: Mon, 30 Apr 2001 15:05:37 -0400
Message-ID: <17688.988657537@sss.pgh.pa.us> (raw)
In-Reply-To: <3AED6EB6.6D808185@flex.ro>
References: <3AED6EB6.6D808185@flex.ro>

Constantin Teodorescu <teo@flex.ro> writes:
> I want a select query with them with 2 outer joins like that
> t0.id = t1.author
> t0.id = t2.id
> Tried :
> select t0.name, t1.title, t2.nickname from authors t0 left outer JOIN
> books t1 ON (t0."id"=t1."author") , authors t0 left outer join nicknames
> t2 on (t0."id"=t2."id") 
> but it says "author table declared more than once".

select t01.name, t01.title, t2.nickname from
    (authors t0 left outer join books t1 on (t0."id"=t1."author")) t01
  left outer join
    nicknames t2 on (t01."id"=t2."id") ;

There are variants but that's the basic idea...

			regards, tom lane



view thread (3+ messages)

Message-ID: <17688.988657537@sss.pgh.pa.us>
Permalink:  ../17688.988657537@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/17688.988657537@sss.pgh.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: tgl@sss.pgh.pa.us, teo@flex.ro
  Subject: Re: MULTIPLE OUTER JOIN SYNTAX :-( can't quess it
  In-Reply-To: <17688.988657537@sss.pgh.pa.us>

* 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