ORA-00979: not a GROUP BY expression
OracleWhat does it mean?
A non-aggregated column was used in the SELECT list together with an aggregate function (SUM, COUNT, etc.), but the column was not added to the GROUP BY clause. Oracle does not know how to group that column.
Why does it happen?
A column in the SELECT but not in the GROUP BY; expressions outside aggregate functions missing from the GROUP BY list; inconsistency in HAVING or select expressions.
How to fix it
Add all non-aggregated columns to the GROUP BY list: SELECT department, COUNT(*) FROM employee GROUP BY department; Alternatively, wrap that column in an aggregate function (MAX, MIN) too, or redesign the grouping with an analytic function (OVER()).
More from this engine
- ORA-01400cannot insert NULL into (column)
- ORA-02291integrity constraint violated - parent key not found
- ORA-02292integrity constraint violated - child record found
- ORA-00918column ambiguously defined
- ORA-06550line/column PLS-... PL/SQL compilation error
- ORA-04068existing state of packages has been discarded
- ORA-01427single-row subquery returns more than one row