SQLite Forum

LEFT JOIN Misunderstanding
Login
It's not a style choice at all really.

If you have
```
   X LEFT Y ON Z
   WHERE W
```

If the conditions are in the `W` clause they will reduce the number of rows returned from `X`.

If the condition is on the `Z` clause then all the rows of `X` will be returned even if some of the `Z` conditions fail. You'll get nulls.

So the `W` doesn't participate in the "leftness" of the join.

In this particular case there were 4 joins and all of the `X` were desired regardless of the join conditions, so all the conditions must go in the `ON`.

`ON` is equivalent to `WHERE` only for `INNER` joins.