Limitations of GROUP BY
Go Up to Grouping Rows with GROUP BY
When using GROUP BY, be aware of the following limitations:
- Each column name that appears in a
GROUP BYclause must also be specified in theSELECTclause. GROUP BYcannot specify a column whose values are derived from a mathematical, aggregate, or user-defined function.GROUP BYcannot be used inSELECTstatements that:
- Contain an
INTOclause (singleton selects). - Use a subquery with a
FROMclause which references a view whose definition contains aGROUP BYorHAVINGclause.
- Contain an
- For each
SELECTclause in a query, including subqueries, there can only be oneGROUP BYclause.