Brian Burleigh wrote: > One response to my post on Stack Overflow, but no solution
Thank you very much for keeping the link a secret. > Studied documentation without being able to de-optimize SET from single > Scalar evaluation. Are you saying "de-optimize" because your query is too fast? If not, what is your question? > SELECT 'Within SET clause, SELECT produces one scalar result'; > with recursive loop(bid) as (Values(1) union all > select bid + 1 from loop LIMIT 3) > UPDATE average SET avrg = > (SELECT AVG(atom) from detail > WHERE grp IN loop GROUP BY grp HAVING grp IN loop) > where rowid IN loop; The subquery is not correlated. You _must_ write the subquery so that it looks up a single row. "grp IN loop" matches many rows; you need something like "grp = average.grp". Regards, Clemens