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 BY
clause must also be specified in theSELECT
clause. GROUP BY
cannot specify a column whose values are derived from a mathematical, aggregate, or user-defined function.GROUP BY
cannot be used inSELECT
statements that:
- Contain an
INTO
clause (singleton selects). - Use a subquery with a
FROM
clause which references a view whose definition contains aGROUP BY
orHAVING
clause.
- Contain an
- For each
SELECT
clause in a query, including subqueries, there can only be oneGROUP BY
clause.