From: | Erik Wienhold <ewie(at)ewie(dot)name> |
---|---|
To: | Shammat <shammat(at)gmx(dot)net> |
Cc: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Left join syntax error |
Date: | 2024-05-18 15:14:32 |
Message-ID: | 4dde36a5-a22e-452a-b395-85ac7bd6bc05@ewie.name |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I wrote:
> But I wonder if the implicit cross join syntax ("FROM peoples, companies")
> should actually produce this error because the explicit cross join
> works:
>
> SELECT p.lname, p.fname, p.job_title, p.company_nbr, p.email, c.company_name
> FROM people as p
> CROSS JOIN companies as c
> LEFT JOIN companies ON c.company_nbr = p.company_nbr;
On second thought it looks like that (companies as c LEFT JOIN companies)
actually is the second FROM item. Adding parenthesis to the explicit
cross join version gives the same error:
SELECT p.lname, p.fname, p.job_title, p.company_nbr, p.email, c.company_name
FROM people as p
CROSS JOIN (
companies as c
LEFT JOIN companies ON c.company_nbr = p.company_nbr
);
So the comma in the FROM item list has lower precedence than the join
operators.
--
Erik
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2024-05-18 15:16:58 | Re: Left join syntax error |
Previous Message | David G. Johnston | 2024-05-18 15:12:35 | Re: Left join syntax error |