Reaper0167 Posted February 21, 2010 Share Posted February 21, 2010 Is there any easy way to get the largest number from a mysql row? I have a column in mysql called count. and each users number could be different. If i want to display 10 results starting at the largest number, what would be the best way? Quote Link to comment https://forums.phpfreaks.com/topic/192790-get-largest-number-from-mysql-row/ Share on other sites More sharing options...
premiso Posted February 21, 2010 Share Posted February 21, 2010 Using the MAX function. Tutorial here: http://www.tizag.com/mysqlTutorial/mysqlmax.php Quote Link to comment https://forums.phpfreaks.com/topic/192790-get-largest-number-from-mysql-row/#findComment-1015540 Share on other sites More sharing options...
sader Posted February 21, 2010 Share Posted February 21, 2010 SELECT * FROM `users_table` ORDER BY `count` DESC LIMIT 0, 10 Quote Link to comment https://forums.phpfreaks.com/topic/192790-get-largest-number-from-mysql-row/#findComment-1015541 Share on other sites More sharing options...
perseadrian Posted February 21, 2010 Share Posted February 21, 2010 Is there any easy way to get the largest number from a mysql row? I have a column in mysql called count. and each users number could be different. If i want to display 10 results starting at the largest number, what would be the best way? select max(row_you_want) from table where condition; This it's the best way. Quote Link to comment https://forums.phpfreaks.com/topic/192790-get-largest-number-from-mysql-row/#findComment-1015641 Share on other sites More sharing options...
PFMaBiSmAd Posted February 21, 2010 Share Posted February 21, 2010 i want to display 10 results starting at the largest number To do what was asked, you would need to use a query like sader posted. Quote Link to comment https://forums.phpfreaks.com/topic/192790-get-largest-number-from-mysql-row/#findComment-1015646 Share on other sites More sharing options...
Reaper0167 Posted February 21, 2010 Author Share Posted February 21, 2010 The examle in the link that premiso provided does not make sense. When it shows the table displayed, it is not in order from largest number to smallest number. I will try what sadar said. Quote Link to comment https://forums.phpfreaks.com/topic/192790-get-largest-number-from-mysql-row/#findComment-1015709 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.