Left join syntax error - Mailing list pgsql-general

From Rich Shepard
Subject Left join syntax error
Date
Msg-id 2c877258-61cc-dd2d-fac7-4f2a5c6293e7@appl-ecosys.com
Whole thread Raw
Responses Re: Left join syntax error
List pgsql-general
It's been a _very_ long time since I wrote a SQL script and, despite looking
at my SQL books and web pages, I don't know how to fix the error.

The three line script is:
-----
SELECT p.lname, p.fname, p.job_title, p.company_nbr, p.email, c.company_name
   FROM people as p, companies as c
LEFT JOIN companies ON c.company_nbr = p.company_nbr;
-----

and psql responds:
ERROR:  invalid reference to FROM-clause entry for table "p"
LINE 3: LEFT JOIN companies ON c.company_nbr = p.company_nbr;
                                                ^
HINT:  There is an entry for table "p", but it cannot be referenced from this part of the query.

Please show me what I've done incorrectly.

TIA,

Rich



pgsql-general by date:

Previous
From: Julien Rouhaud
Date:
Subject: Re: Execution history of a single query
Next
From: Shammat
Date:
Subject: Re: Left join syntax error