How to find maximum avg

前端 未结 15 2253
长情又很酷
长情又很酷 2020-12-15 19:17

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:



        
15条回答
  •  不知归路
    2020-12-15 19:59

    https://stackoverflow.com/a/8050885/12190487 shows the folllowing error

    ER_DERIVED_MUST_HAVE_ALIAS: Every derived table must have its own alias
    

    Use alias for the new formed column you are selecting from

    select max(avg_salary)
    from (select worker_id, avg(salary) AS avg_salary
          from workers
          group by worker_id) as avg ; 
    

提交回复
热议问题