+ 1

how can we print max salary from different city with mysql

database

21st Jul 2018, 12:16 PM
Vineet Dixit
Vineet Dixit - avatar
6 Respostas
+ 1
SELECT salary FROM table_name WHERE city_name = "City_name" ORDER BY salary DESC LIMIT = 1 //I need to check if its right .. haven't seen sql in ages. but it should be something like that.
21st Jul 2018, 12:38 PM
Akib
Akib - avatar
0
sorry bt i want to ask for different city having higest salary with there full information
21st Jul 2018, 12:58 PM
Vineet Dixit
Vineet Dixit - avatar
0
Can you explain more?
21st Jul 2018, 1:04 PM
Akib
Akib - avatar
0
yes... i want to print full detail of employee who is having highest salary from each city...i have 5 city in my database and having 10 employees atleast
21st Jul 2018, 1:06 PM
Vineet Dixit
Vineet Dixit - avatar
0
SELECT salary FROM table_name WHERE city_name IN ("City_name1", "City_name2", .........)ORDER BY salary DESC LIMIT = 1
21st Jul 2018, 1:31 PM
Akib
Akib - avatar
0
it doesent worked bt i got a right query...i.e select *from table_name where salary in (select max(salary) from table_name group by (city)); by the way thanks alot for ur effort...
21st Jul 2018, 2:04 PM
Vineet Dixit
Vineet Dixit - avatar