ASA SQL User's Guide
Summarizing, Grouping and Sorting Query Results
Standards and compatibility
The SQL/92 standard for GROUP BY requires the following:
A column used in an expression of the SELECT clause must be in the GROUP BY clause. Otherwise, the expression using that column is an aggregate function.
A GROUP BY expression can only contain column names from the select list, but not those used only as arguments for vector aggregates.
The results of a standard GROUP BY with vector aggregate functions produce one row with one value per group.
Adaptive Server Anywhere and Adaptive Server Enterprise support extensions to HAVING that allow aggregate functions not in the select list and not in the GROUP BY clause.