pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Phillip Smith <phillips@weatherbeeta.com.au>
To: 'Ehab Galal' <ehabgalal123@hotmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: SQL command join question
Date: Thu, 30 Nov 2006 11:46:14 +1100
Message-ID: <009301c71418$f26e3d30$9b0014ac@wbaus090> (raw)
In-Reply-To: <BAY24-F23D89B0EEF2CFB0C611FFA96DB0@phx.gbl>

Would this be more appropriate...?
	SELECT t1.*
	FROM t1
	OUTER JOIN t2 ON (t1.a=t2.a AND t1.b=t2.b)
	OUTER JOIN t3 ON (t1.c=t3.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 
outer join them as shown below, but only have all tuples from t1 as output. 
But the following syntax does not allow me to do so.

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);

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 
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 
http://imagine-windowslive.com/search/kits/default.aspx?kit=improve&locale=e
n-US&source=hmemailtaglinenov06&FORM=WLMTAG


---------------------------(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



view thread (5+ messages)  latest in thread

Message-ID: <009301c71418$f26e3d30$9b0014ac@wbaus090>
Permalink:  ../009301c71418$f26e3d30$9b0014ac@wbaus090/
Also on:    postgresql.org/message-id/009301c71418$f26e3d30$9b0014ac@wbaus090

 · 

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-sql@postgresql.org
  Cc: phillips@weatherbeeta.com.au, ehabgalal123@hotmail.com
  Subject: Re: SQL command join question
  In-Reply-To: <009301c71418$f26e3d30$9b0014ac@wbaus090>

* 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