Index: src/wherecode.c ================================================================== --- src/wherecode.c +++ src/wherecode.c @@ -2055,11 +2055,11 @@ assert( pE!=0 ); if( pLevel->iLeftJoin && !ExprHasProperty(pE, EP_FromJoin) ){ continue; } - if( iNext==1 && !sqlite3ExprCoveredByIndex(pE, pLevel->iTabCur, pIdx) ){ + if( iLoop==1 && !sqlite3ExprCoveredByIndex(pE, pLevel->iTabCur, pIdx) ){ iNext = 2; continue; } if( iLoop<3 && (pE->flags & EP_VarSelect) ){ if( iNext==0 ) iNext = 3;