How to find maximum avg

前端 未结 15 2167
长情又很酷
长情又很酷 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 20:20

    You can in this way that the first row is sorted in descending based on average find

    select top 1  worker_id, avg(salary) as avgsalary 
          from workers
          group by worker_id 
          order by avgsalary desc
    

提交回复
热议问题