Learn the motive and how to resolve the ORA-00937 error message in Oracle.
When you encounter an ORA-00937 error, the following error message will appear:
ORA-00937: not a single-group group function
You tried to execute a SELECT announcement that blanketed a GROUP BY function (ie: MIN Function, MAX Function, SUM Function, COUNT Function), however was once missing the GROUP BY clause.
The option(s) to resolve this Oracle error are:
Rewrite the SELECT statement so that the column or expression listed in the SELECT listing is additionally discovered in the GROUP BY clause.
Remove the GROUP BY function (ie: MIN Function, MAX Function, SUM Function, COUNT Function) from the SELECT statement.
Remove the expression from the SELECT listing that was once not in the GROUP BY clause.
For example, if you had tried to execute the following SELECT statement:
SELECT department, MIN(salary) AS "Lowest salary" FROM employees;
You would receive the following error message:
You should correct this via together with department in the GROUP BY clause as follows:
SELECT department, MIN(salary) AS "Lowest salary" FROM employees GROUP BY department;