Fix incorrect sqlite query generated for SELECT ... FROM x ... JOIN y ... LEFT JOIN z