2149 Aggregate function not allowed in this context

Advantage Error Guide

Problem: An SQL statement used an aggregate function (SUM, AVG, MIN, MAX, COUNT) in an incorrect manner.

Solution: Do not use aggregate functions in column lists. For example, "INSERT INTO mytable (field) VALUES (MIN(field))" is not valid.