Re: [NF] Conditions in JOIN clause instead of WHERE

Author: Frank Cazabon

Posted: 2019-04-04 at 07:53:22

Garrett,

> LEFT JOIN b ON a.key = b.key*AND b.field = 'Value'*

is it the conditions/filters (AND b.field = 'Value') that you are asking

about, not the difference between WHERE and JOIN?

If so, then this might help:

https://stackoverflow.com/questions/10517225/filtering-joins-where-vs-on

or this:

https://stackoverflow.com/questions/10297231/where-clause-vs-on-when-using-join

Frank.

Frank Cazabon

On 02/04/2019 06:05 PM, Garrett Fitzgerald wrote:

> Hey, all. I had a general SQL question. Often, I find myself needing to use

> the syntax:

>

> FROM a

> LEFT JOIN b ON a.key = b.key AND b.field = 'Value'

>

> because if I filter b.field in the WHERE clause, I've effectively made the

> LEFT JOIN an inner one.

>

> That makes me wonder, at what point do we stop moving conditions to the

> JOIN clause? Obviously, some can't move for syntactical reasons, such as

> subqueries. But short of that, when does it make sense to limit a non-outer

> join in the join criteria? Never?

>

>

> --- StripMime Report -- processed MIME parts ---

> multipart/alternative

> text/plain (text body -- kept)

> text/html

> ---

>

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox

OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/890d3fb4-5186-3006-d40c-9e188c6846e5@gmail.com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2019 Frank Cazabon