Unable to proceed with Group By clause - incorrect argument list
This message appears when a SELECT statement contains inappropriate arguments in the GROUP BY, HAVING, WITH SAMPLE OF, and ORDER BY clauses.
Every value expression in the projection list that does not contain an aggregate function must also appear in the GROUP BY clause (note that derived columns can only be referenced by their numeric position in the projection list). Aggregate functions cannot appear in the GROUP BY clause. The HAVING clause must include either an aggregate function or a grouped column (that is, a column listed in the GROUP BY clause). The ORDER BY clause must include a grouped column.
The optional SELECT clauses, if included, must appear in the following order: