15.00 - 3504 Selected non-aggregate values must be part of the associated group. - Teradata Database

Teradata Database Messages

Product
Teradata Database
Release Number
15.00
Content Type
Programming Reference
Publication ID
B035-1096-015K
Language
English (United States)

3504 Selected non-aggregate values must be part of the associated group.

Explanation:

This error occurs when an aggregate query includes a non-aggregate expression in the SELECT list, WHERE clause, ORDER BY clause, HAVING clause or WITH list that is not also exactly specified in the corresponding GROUP BY or WITH...BY clause. Note that we also return this error when ORDER BY and WITH clauses contain aggregates but the query does not.

Generated By:

OPT modules.

For Whom:

End User.

Notes:

For example, it is not legal to: SELECT State GROUP BY ZipCode; . In order for the request to be legal, it may be changed to: SELECT State GROUP BY State, ZipCode; . It is also not legal to: SELECT StateNo WITH SUM(StateNo) ORDER BY SUM(StateNo) ; A legal request is: SELECT SUM(StateNo) WITH SUM(StateNo) ORDER BY SUM(StateNo) ;

Remedy:

Correct the request and resubmit it.