Error 904

"Illegal ORDER BY in aggregate function"

Item Description

SQLCode

-904L

Constant

INVALID_ORDERBY_IN_AGGREGATE

SQLState

42W90

ODBC 2 State

37000

ODBC 3 State

42000

Sybase Error Code

2570

Severity Code

15

Probable cause

An ORDER BY can be used in an aggregate function only if there are no DISTINCT aggregates in the select list, or there is a single DISTINCT aggregate with the DISTINCT column equal to the first column of the ORDER BY. Also, multiple ordered aggregates cannot be used in the same select list unless they have the exact same ORDER BY clause.


Created April 27, 2010. Send feedback on this help topic to Sybase Technical Publications: pubs@sybase.com