ramesh_iridium Posted July 14, 2008 Share Posted July 14, 2008 HI How to select highest 3 salaries from a table ? Please give your solutions ... Ramesh Link to comment https://forums.phpfreaks.com/topic/114622-how-to-select-highest-3-salaries-from-a-table/ Share on other sites More sharing options...
Xurion Posted July 14, 2008 Share Posted July 14, 2008 SELECT salary FROM salaries ORDER BY salary LIMIT 3 Link to comment https://forums.phpfreaks.com/topic/114622-how-to-select-highest-3-salaries-from-a-table/#findComment-589404 Share on other sites More sharing options...
fenway Posted July 14, 2008 Share Posted July 14, 2008 You're missing "DESC". Link to comment https://forums.phpfreaks.com/topic/114622-how-to-select-highest-3-salaries-from-a-table/#findComment-589760 Share on other sites More sharing options...
Xurion Posted July 15, 2008 Share Posted July 15, 2008 Doesn't it do that automatically? Link to comment https://forums.phpfreaks.com/topic/114622-how-to-select-highest-3-salaries-from-a-table/#findComment-590273 Share on other sites More sharing options...
fenway Posted July 15, 2008 Share Posted July 15, 2008 Doesn't it do that automatically? No -- why would it? It defaults to ASC, but you should never rely on this. Always ask for what you want explicitly -- no suprises. Link to comment https://forums.phpfreaks.com/topic/114622-how-to-select-highest-3-salaries-from-a-table/#findComment-590524 Share on other sites More sharing options...
Xurion Posted July 16, 2008 Share Posted July 16, 2008 Sorry wasn't thinking straight yesterday - for some reason I assumed it sorted the other way around by default =_= I agree with Fen, you should specify for no unexpected results. Link to comment https://forums.phpfreaks.com/topic/114622-how-to-select-highest-3-salaries-from-a-table/#findComment-591349 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.