Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 919149FB283 for ; Wed, 29 Nov 2006 20:53:50 -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 28385-09 for ; Wed, 29 Nov 2006 20:53:41 -0400 (AST) X-Greylist: delayed 00:06:38.019304 by SQLgrey-1.7.4 Received: from weatherbeeta.com.au (218-214-212-153.people.net.au [218.214.212.153]) by postgresql.org (Postfix) with SMTP id F08579FB279 for ; Wed, 29 Nov 2006 20:53:44 -0400 (AST) Received: (qmail 15372 invoked from network); 30 Nov 2006 00:47:02 -0000 X-NetworkBox-HamSign: 0101;OUT;wbeetaau1;9441e9fbcdc1987ce6d6d71cb1da8c5b; Received: from mail.weatherbeeta.com.au (HELO SRV-Email) (172.20.0.2)by network-box.weatherbeeta.com.au with SMTP; 30 Nov 2006 00:47:02 -0000 Received: from 172.20.0.155 ([172.20.0.155]) by SRV-Email (602Pro LAN SUITE 2003) id 2d6258cd; Thu, 30 Nov 2006 11:46:18 +1100 Reply-To: From: "Phillip Smith" To: "'Ehab Galal'" , Subject: Re: SQL command join question Date: Thu, 30 Nov 2006 11:46:14 +1100 Message-ID: <009301c71418$f26e3d30$9b0014ac@wbaus090> MIME-Version: 1.0 Content-Type: text/plain;charset="US-ASCII" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962 In-Reply-To: Importance: Normal X-Scanned-By-wbeetaau1: Virus scan performed by network-box X-Scanned-By-wbeetaau1: Scanner file id is wbeetaau1-1164847622.131-15367-000 X-Scanned-By-wbeetaau1: No known viruses found in message (received+scanned in 0.03/0.09 secs) X-Scanned-By-wbeetaau1: Spam-Check-Result: No, hits=0 required=7 tests= autolearn=no version=2.0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/282 X-Sequence-Number: 26934 Would this be more appropriate...? SELECT t1.* FROM t1 OUTER JOIN t2 ON (t1.a=3Dt2.a AND t1.b=3Dt2.b) OUTER JOIN t3 ON (t1.c=3Dt3.c); -----Original Message----- From: pgsql-sql-owner@postgresql.org = [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Ehab Galal Sent: Thursday, 30 November 2006 11:42 To: pgsql-sql@postgresql.org Subject: [SQL] SQL command join question Hi, I have three tables t1(a, b, c, d), t2(a, b, c, k), and t3(c, e). I need = to=20 outer join them as shown below, but only have all tuples from t1 as = output.=20 But the following syntax does not allow me to do so. SELECT t1.* FROM (t1 outer join t2 on (t1.a=3Dt2.a and t1.b=3Dt2.b)) t outer join t3 = on=20 (t1.c=3Dt3.c); I'm getting the following error message: ERROR: invalid reference to FROM-clause entry for table "t1" HINT: There is an entry for table "t1", but it cannot be referenced = from=20 this part of the query. I'll be grateful if someone may help me with this. Thanks, Ehab _________________________________________________________________ Fixing up the home? Live Search can help=20 http://imagine-windowslive.com/search/kits/default.aspx?kit=3Dimprove&loc= ale=3De n-US&source=3Dhmemailtaglinenov06&FORM=3DWLMTAG ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend *******************Confidentiality and Privilege Notice******************* The material contained in this message is privileged and confidential to the addressee. If you are not the addressee indicated in this message or responsible for delivery of the message to such person, you may not copy or deliver this message to anyone, and you should destroy it and kindly notify the sender by reply email. Information in this message that does not relate to the official business of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta. Weatherbeeta, its employees, contractors or associates shall not be liable for direct, indirect or consequential loss arising from transmission of this message or any attachments