If your queries have a GROUP BY clause, some syntax combinations are invalid and result in Oracle error messages.
You may get the following error message.
ORA-00937: not a single-group group function.
It means that there is a mismatch between your SELECT clause and your GROUP BY clause.
The following table lists valid versus invalid syntax.
Syntax | Valid? |
---|---|
select a, b, max(c) from t ... group by a | No |
select a, b, max(c) from t ... group by a,b | Yes |
select a, count(b), min(c) from t ... group by a | Yes |
select count(c) from t ... group by a | Yes |
Here are the two general rules: