public inbox for [email protected]  
help / color / mirror / Atom feed
From: Erik Wienhold <[email protected]>
To: Shammat <[email protected]>
Cc: [email protected]
Subject: Re: Left join syntax error
Date: Sat, 18 May 2024 17:14:32 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>

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






view thread (6+ messages)  latest in thread

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: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Left join syntax error
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox