Teradata Database Message 3504 - 17.10 - 3504 - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - Database Messages

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1096-171K
Language
English (United States)
Message
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.