Hello everyone,

I wrote this statement and i don't know why i get an error, please advice anyone.

SELECT MAX(AVG(salary)),MIN(AVG(salary)), department_id
FROM employees
GROUP BY department_id

ERROR:
ORA-00937: not a single-group group function

thanks

Member Avatar for michelleradu

From http://ora-00937.ora-code.com/ :
ORA-00937: not a single-group group function
Cause: A SELECT list cannot include both a group function, such as AVG, COUNT, MAX, MIN, SUM, STDDEV, or VARIANCE, and an individual column expression, unless the individual column expression is included in a GROUP BY clause.
Action: Drop either the group function or the individual column expression from the SELECT list or add a GROUP BY clause that includes all individual column expressions listed.

So you might want to add "salary" to the GROUP BY clause.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.