Deyan8777 Posted February 7, 2017 Share Posted February 7, 2017 (edited) i got table employees with ID , NAME , SALARY i need to select all employees having max salary. i need to self join the table and i must not use subselect. For now only 2 employees got the max salary how to select both of them select e.name, max(e.salary) from employees as e left join employees as es on e.id=es.id this only select one of the employees having max salary i need and the other one Edited February 7, 2017 by Deyan8777 Quote Link to comment https://forums.phpfreaks.com/topic/303125-i-need-help-guys/ Share on other sites More sharing options...
requinix Posted February 7, 2017 Share Posted February 7, 2017 Forget about max for this. Think about what would happen if you joined the table against itself and with the condition that the second table's rows have a higher salary than the first table's... Quote Link to comment https://forums.phpfreaks.com/topic/303125-i-need-help-guys/#findComment-1542418 Share on other sites More sharing options...
Deyan8777 Posted February 7, 2017 Author Share Posted February 7, 2017 i am stuck with this from 2 weeks ....can't find a solution, i found only with subselect....that i dont need Quote Link to comment https://forums.phpfreaks.com/topic/303125-i-need-help-guys/#findComment-1542419 Share on other sites More sharing options...
Jacques1 Posted February 7, 2017 Share Posted February 7, 2017 I know this will probably sound crazy to you, but how about reading the replies? The solution is right in front of you. All you have to do is stop complaining and open your eyes. Quote Link to comment https://forums.phpfreaks.com/topic/303125-i-need-help-guys/#findComment-1542420 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.