Re: LEFT and RIGHT JOIN

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Misa Simic <misa(dot)simic(at)gmail(dot)com>
Cc: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: LEFT and RIGHT JOIN
Date: 2012-06-29 22:36:52
Message-ID: 24369.1341009412@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Misa Simic <misa(dot)simic(at)gmail(dot)com> writes:
> Yes you are right... I wanted: t1 left join (t2 inner join t3)
> Is there a way to "say" that?

Sure, just add the parentheses.

t1 left join (t2 inner join t3 on t2-t3-condition) on t1-t2-condition

> 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...)...

Well, that might or might not be more intuitive, but the SQL standard
says these bind equally, left to right, unless you use parens.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Misa Simic 2012-06-29 22:37:03 Re: LEFT and RIGHT JOIN
Previous Message Misa Simic 2012-06-29 22:20:57 Re: LEFT and RIGHT JOIN