I am trying to display the maximum average salary; however, I can't seem to get it to work.
I can get a list of the average salaries to display with:
select worker_id, avg(salary)
from workers
group by worker_id;
However, when I try to display a list of the maximum average salary with:
select max (avg(salary))
from (select worker_id, avg(salary)
from workers
group by worker_id);
it doesn't run. I get an "invalid identifier" error. How do I use the average salary for each worker to find the maximum average for each worker?
Thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…