Answer the question
In order to leave comments, you need to log in
mysql: how to select top5 from groups?
There is a table:
id,name,otdel,money
-----------------
1,alex,it,1000
2,anna,callcenter,2000
3,anton,it,3000
etc.
You need to choose from each department the top 5 employees with the highest salary.
For one group, I can make a query select * from users group by otdel ordeer by money asc limit 3 or something like that ..
Please write a query with an explanation, otherwise I met solutions to such problems on the Internet, but I couldn’t comprehend it ..
Answer the question
In order to leave comments, you need to log in
I need to select the top 5 employees with the highest salary from all departments with one request.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question