SQLite Forum

Help rewriting a query to match the speed of a 2nd query
Login
Except it is a stupid suggestion.  Your two queries produce different results because they are, well, different.  Which one is correct?

Note that a SCALAR SUBQUERY only returns the FIRST row retrieved so trying to have it return multiple rows is asinine stupid and will not have the effect intended.  (Well, actually it will, the result intended being Garbage In Garbage Out, and that will be the result).

You are probably missing an index.