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? 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 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 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. 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. 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. 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
Archived
This topic is now archived and is closed to further replies.