Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 2B9D89FB264 for ; Wed, 29 Nov 2006 21:02:47 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 29250-08 for ; Wed, 29 Nov 2006 21:02:32 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 53E569FB21D for ; Wed, 29 Nov 2006 21:02:37 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id kAU12Ye6006757; Wed, 29 Nov 2006 20:02:34 -0500 (EST) To: "Ehab Galal" cc: pgsql-sql@postgresql.org Subject: Re: SQL command join question In-reply-to: References: Comments: In-reply-to "Ehab Galal" message dated "Wed, 29 Nov 2006 19:41:42 -0500" Date: Wed, 29 Nov 2006 20:02:34 -0500 Message-ID: <6756.1164848554@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/285 X-Sequence-Number: 26937 "Ehab Galal" 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