3 way outer join dilemma - Mailing list pgsql-general

From
Subject 3 way outer join dilemma
Date
Msg-id 000c01c365e3$d0332460$2766f30a@development.greatgulfhomes.com
Whole thread Raw
Responses Re: 3 way outer join dilemma  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Re: 3 way outer join dilemma  ("scott.marlowe" <scott.marlowe@ihs.com>)
List pgsql-general
Here's what I have (simplified)

SELECT t1.fid, t1.t1_data, t2.vid, t2.t2_data, t3.t3_data
FROM t1, t2, t3
WHERE t1.fid = X
  AND t2.vid = Y
  AND t3.fid = t1.fid
  AND t3.vid = t2.vid

Now, I discover that the record in t3 may not always exist, so somehow I
want to do an outer join...

SELECT t1.fid, t1.t1_data, t2.vid, t2.t2_data, t3.t3_data
FROM t1, t2, OUTER JOIN t3 ON (t3.fid = t1.fid AND t3.vid = t2.vid)
WHERE t1.fid = X
  AND t2.vid = Y

But I get the statement that "t1 is not part of JOIN"

Is there some way that I can merge t1 and t2 together, or do I have to do a
subselect (ugh) as the only viable alternative?

Any ideas is appreciated...

Terry Fielder
Manager Software Development and Deployment
Great Gulf Homes / Ashton Woods Homes
terry@greatgulfhomes.com
Fax: (416) 441-9085


pgsql-general by date:

Previous
From: Dennis Gearon
Date:
Subject: Re: Why lower's not accept an AS declaration ?
Next
From: Stephan Szabo
Date:
Subject: Re: Why lower's not accept an AS declaration ?