On 18 Feb 2019, at 1:33pm, Rocky Ji <rockyji3...@gmail.com> wrote: > Here's the new thing: https://pastebin.com/raw/pSqjvJdZ > > Again, can we get rid of them sub-query?
The "sum()" with the "group by" in the subquery make it difficult. There's nothing wrong with that query just as it is. In that form SQLite will figure out a very efficient query plan for what you're trying to do. Don't worry about there being a subquery in there. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users