Re: LEFT and RIGHT JOIN - Mailing list pgsql-general

From Misa Simic
Subject Re: LEFT and RIGHT JOIN
Date
Msg-id CAH3i69=JMhSnPmcWgnP_xeub=2PQNqKTNCwUk0Rqzn2AAw76Wg@mail.gmail.com
Whole thread Raw
In response to Re: LEFT and RIGHT JOIN  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: LEFT and RIGHT JOIN  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Thanks Tom,

Yes you are right... I wanted: t1 left join (t2 inner join t3)
Is there a way to "say" that? I mean to me, it is logical and without brackets... i.e. t1 left join t2 inner join t3 left join t4, I would read as: t1 left join (t2 inner join t3) left join t4 .... (Like INNER has advantage on OUTER...)...

(But I believe my logic is wrong - because of I have tried that on different SQL engines...)

Or the only way to "say" that is to dont care is there INNER or not... Just put brackets (in head) from left to right in row how table shows in line and if you want SELECT all from 1 table make sure it is on the end of the line (in that case you will need to use RIGHT of course)? 

Thanks,

Misa 

2012/6/29 Tom Lane <tgl@sss.pgh.pa.us>
Perhaps you're confused about the syntactic binding of JOINs?
The first query is (t1 left join t2) inner join t3, while the last one
is (t3 inner join t2) right join t1, which is the same as
t1 left join (t2 inner join t3), which is not typically the same
thing as the first one, because inner joins don't associate in or out
of the nullable side of an outer join.

                       regards, tom lane

pgsql-general by date:

Previous
From: Ben Chobot
Date:
Subject: Re: Promotion of standby to master
Next
From: Tom Lane
Date:
Subject: Re: LEFT and RIGHT JOIN