Re: SQL command join question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Ehab Galal" <ehabgalal123(at)hotmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: SQL command join question
Date: 2006-11-30 01:02:34
Message-ID: 6756.1164848554@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Ehab Galal" <ehabgalal123(at)hotmail(dot)com> writes:
> SELECT t1.*
> FROM (t1 outer join t2 on (t1.a=t2.a and t1.b=t2.b)) t outer join t3 on
> (t1.c=t3.c);

> ERROR: invalid reference to FROM-clause entry for table "t1"
> HINT: There is an entry for table "t1", but it cannot be referenced from
> this part of the query.

Drop the alias on the outer join (the "t"). Per SQL spec, that masks
table names (and aliases) within the join from the rest of the query.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Fuhr 2006-11-30 07:58:23 Re: consistent random order
Previous Message Richard Broersma Jr 2006-11-30 00:57:18 Re: SQL command join question