Re: SQL command join question - Mailing list pgsql-sql

From Tom Lane
Subject Re: SQL command join question
Date
Msg-id 6756.1164848554@sss.pgh.pa.us
Whole thread Raw
In response to SQL command join question  ("Ehab Galal" <ehabgalal123@hotmail.com>)
List pgsql-sql
"Ehab Galal" <ehabgalal123@hotmail.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


pgsql-sql by date:

Previous
From: Richard Broersma Jr
Date:
Subject: Re: SQL command join question
Next
From: Michael Fuhr
Date:
Subject: Re: consistent random order