Re: Difference between ON and WHERE in JOINs

From: Jean-Christophe Boggio <postgresql(at)thefreecat(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Difference between ON and WHERE in JOINs
Date: 2012-09-19 15:39:47
Message-ID: 5059E743.5070204@thefreecat.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Le 19/09/2012 17:08, Merlin Moncure a écrit :
> SELECT * FROM foo LEFT JOIN BAR ON foo.id = bar.id AND bar.col = 'something';
>
> The difference here is that the filtering is now happening at join
> time where the left join semantics are playing: always return foo and
> return bar rows if and only if the join condition is met.

Ok, as a rule of thumb, should I put in the where clause only the
conditions related to foo and inner joins ? All other (outer) conditions
should then go on their respective 'ON' clauses ?

JC

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Robert Sosinski 2012-09-19 15:49:12 Re: Time-based trigger
Previous Message Jean-Christophe Boggio 2012-09-19 15:33:37 Re: Difference between ON and WHERE in JOINs