Invalid use of an aggregate function

Error constant SQLE_AGGREGATES_NOT_ALLOWED
ODBC 2 State 37000
ODBC 3 State 42000
Severity 15
SQLCODE –150
SQLSTATE 42W06
Sybase error code 13204
Probable cause

You attempted to use an aggregate function inappropriately. For example, a SELECT statement cannot contain an aggregate function within a predicate in the WHERE clause unless the aggregate function constitutes an outer reference. Other invalid uses include specifying an aggregate function in the SET clause of an UPDATE statement, or using an aggregate function in a CHECK constraint.