Re: JOINs in FROM... - Mailing list pgsql-novice

From Stoffel van Aswegen
Subject Re: JOINs in FROM...
Date
Msg-id 9D8BB61A24FCD0118E83080036CE9603D2E6D7@ntserver01.gmsi.co.za
Whole thread Raw
In response to JOINs in FROM...  ("ericnielsen@pop.ne.mediaone.net" <ericnielsen@pop.ne.mediaone.net>)
List pgsql-novice
SELECT *
FROM foo
LEFT JOIN (SELECT * FROM bar ... ON ...)
WHERE ...

In your query you missed a 'SELECT' in the brackets.
I'm not sure if PostgreSQL supports LEFT JOINS - perhaps someone can
comment.

-----Original Message-----
From: ericnielsen@pop.ne.mediaone.net
[mailto:ericnielsen@pop.ne.mediaone.net]
Sent: 17 September 2001 04:23
To: pgsql-novice@postgresql.org
Subject: [NOVICE] JOINs in FROM...


I've been trying to use the JOIN syntax in the FROM clause instead of
burying all the joins in the WHERE.  (Does postgres actually support outer
joins now? the user manual seems to imply it does, which version do I need
as a minimum?)  The resulting query is much simpler than my old UNION SELECT
cascade, but I must have done something wrong because I get a parse error.

Here's the query and the error.(formatted for monotype)
SELECT ldr.peopleid, ldr.firstname, ldr.lastname, ldr.name,
       flw.peopleid, flw.firstname, flw.lastname, flw.name
       FROM (people LEFT JOIN organizatios ON organization=orgid) AS ldr,
            (poeple LEFT JOIN organizatios ON organization=orgid) AS flw,
            couples
       WHERE ldr.peopleid=leader and flw.peopleid=follower
       ORDER BY ldr.lastname, ldr.firstname, flw.lastname, flw.firstname;
Warning: PostgreSQL query failed: ERROR: parser: parse error at or near ","

1) What is the problem with my query?
2) Is there any good way to move the last two joins into the FROM?

Thanks
Eric



--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

pgsql-novice by date:

Previous
From: ksprague@NRCan.gc.ca
Date:
Subject: populating postgresql from tab-delimited text file
Next
From: "ericnielsen@pop.ne.mediaone.net"
Date:
Subject: JOINs in FROM...