The GROUP BY clause orders the result set according to an alias specified in the SELECT statement.
Syntax
GROUP BY [alias]...
Notes
In this instance, the alias may be used as a simple column reference to a database table, or an actual expression composed of arithmetic expressions, character operators, date operators, or scalar functions. The alias is essentially an alternate name.
Example
In the following example, the GROUP BY clause refers to the "CityState" phrase of the SELECT statement:
SELECT CONCAT (State, City) AS "CityState",
COUNT (city)
FROM Pub.Customer
GROUP BY "CityState";