In this blog post, you’ll learn more about the Sybase Error Function or column reference to ‘%1’ must also appear in a GROUP BY and the reason for receiving this error
Sybase SQL Error Message
Function or column reference to ‘%1’ must also appear in a GROUP BY
Reason for this Error
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.