An aggregate function such as SUM() was used in a context where it is not permitted, such as a WHERE clause.