SQLite has become picky about the terms in the ON clause of joins some time ago. The fragment "t0 LEFT JOIN t2 ON t0.c0=t1.c1" does not actually constrain t2 at all, but references an as yet unknown table. I would consider this a semantic error and SQLite is quite right for telling you off on it. I suspect with optimization turned on, the statement is interpreted as t0 LEFT JOIN (t2 JOIN t1 ON t1.c0>t2.c0) ON t0.c0=t1.c1 which "shifts" the offending ON clause to a position where it can be checked