+ 1

Hi I can't do this command how can I do it? ? SELECT MAX( Avg(sal) ),deptno FROM emp Group by deptno;

,ORACLE DataBase

3rd Jan 2022, 10:44 AM
Anas Mohammed Sarhan Saif
Anas Mohammed Sarhan Saif - avatar
5 Answers
+ 1
Your sql statement looks fine, no syntax errors. Does the table exist in your database? What is the error you are getting?
4th Jan 2022, 1:25 AM
Sandy Ho
Sandy Ho - avatar
+ 1
Assuming you are trying to get the max of all the average sal, this should work SELECT MAX(avgsal) FROM (SELECT AVG(sal) AS avgsal, deptno FROM emp GROUP BY deptno) AS avgEmp
5th Jan 2022, 7:45 AM
Sandy Ho
Sandy Ho - avatar
0
Oh yes i forrget some thing in my Quastion
5th Jan 2022, 3:52 AM
Anas Mohammed Sarhan Saif
Anas Mohammed Sarhan Saif - avatar
0
SELECT MAX(Avg(sal) ) ,deptno FROM emp Group by deptno;
5th Jan 2022, 3:53 AM
Anas Mohammed Sarhan Saif
Anas Mohammed Sarhan Saif - avatar
0
All thinks, if you know another method it's good i need it
5th Jan 2022, 8:30 AM
Anas Mohammed Sarhan Saif
Anas Mohammed Sarhan Saif - avatar