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:
You can fix the query by adding a column alias to the column within the sub-query, like so:
select max(avg_salary)
from (select worker_id, avg(salary) avg_salary
from workers
group by worker_id);
However, if worker_id uniquely identifies records on the workers table, this is functionally equivalent to (can be simplified to):
select max(salary) from workers;