SQLite Forum

.expert Error: ON clause references tables to its right
`AND a.InsertDate = f.pl_insert` is attached as the descent condition into Project_Extras (b) however the table known as "f" has not yet been introduced.

This is an error.

Technically, the syntactic sugar "ON" can only be used to introduce a conditional expression which references tables which have already been seen (as in have already been FROM <blah> or JOIN <blah> and a reference to a table which HAS NOT YET BEEN SEEN is an error).

The condition between `a` and `f` cannot be attached as a descent qualifier for `b`.  The query executes however because the planner chooses a traverse order that ensures that `f` is in outer loop before descent into `b`.

Technically, however, many of your descent (ON clause after a LEFT JOIN) are invalid.