Search Postgresql Archives

Re: LEFT and RIGHT JOIN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux