On Sun, 23 Oct 2011 10:26:14 -0700, Pete <[email protected]> wrote:
>Apologies, I omitted what is the real cause of the problem. This simplified >SELECT illustrates the error: > >SELECT sum( colc * cold ) as total from tst where total > 1000 > >The error message is "misuse of aggregate: sum()". No error if I remove the >where clause. A condition on an aggregate is expressed with a HAVING clause, not a WHERE clause. That is because WHERE and HAVING work on different stages of the SELECT statement: WHERE decides which rows to include in the aggregate, HAVING decides which results to present after aggregation. -- ( Kees Nuyt ) c[_] _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

