Error 149

"Function or column reference to '%1' must also appear in a GROUP BY"

Item Description

SQLCode

-149L

Constant

INVALID_GROUP_SELECT

SQLState

53003

ODBC 2 State

37000

ODBC 3 State

42000

Sybase Error Code

2092

Severity Code

15

Parameter 1

Name of the column referenced directly, or in an expression, that must be in the GROUP BY clause.

Probable cause

You used a non-aggregate function or column reference in the SELECT list or in a nested query block that does not appear in the GROUP BY clause. In a query using GROUP BY, SELECT list items that are not aggregate functions must also appear in the GROUP BY clause. If the SELECT list item is a column reference or an alias, you may add the column name or alias to the GROUP BY clause. If the SELECT list item is a scalar function, ensure that the function's arguments in the GROUP BY clause match exactly with those in the SELECT list. You may be able to use the MAX function (or another aggregate function) on the column name instead of adding the column to the GROUP BY clause.


Created November 10, 2011. Send feedback on this help topic to Sybase Technical Publications: pubs@sybase.com