ted_chou12 Posted February 10, 2007 Share Posted February 10, 2007 i have a mysql table column storing purely figures: eg. number 1 3 5 6 2 How can you get the biggest number? so what I want the output to be is "6" since is the biggest number in all of the rows. Thanks Ted Link to comment https://forums.phpfreaks.com/topic/37888-how-to-get-the-biggest-number/ Share on other sites More sharing options...
redbullmarky Posted February 10, 2007 Share Posted February 10, 2007 SELECT * FROM mytable ORDER BY thefield DESC LIMIT 1 Link to comment https://forums.phpfreaks.com/topic/37888-how-to-get-the-biggest-number/#findComment-181377 Share on other sites More sharing options...
ted_chou12 Posted February 10, 2007 Author Share Posted February 10, 2007 Thanks redbullmarky, i think max is what I wish to use, however, it doesnt seem to work with DATE formats, can anyone help me out please? Link to comment https://forums.phpfreaks.com/topic/37888-how-to-get-the-biggest-number/#findComment-181379 Share on other sites More sharing options...
wildteen88 Posted February 10, 2007 Share Posted February 10, 2007 Then use redbullmarky's suggestion and use the ORDER BY clause. Link to comment https://forums.phpfreaks.com/topic/37888-how-to-get-the-biggest-number/#findComment-181380 Share on other sites More sharing options...
ted_chou12 Posted February 10, 2007 Author Share Posted February 10, 2007 okay, ill have a go with that Link to comment https://forums.phpfreaks.com/topic/37888-how-to-get-the-biggest-number/#findComment-181381 Share on other sites More sharing options...
AndyB Posted February 10, 2007 Share Posted February 10, 2007 ... however, it doesnt seem to work with DATE formats Ted - ask your real question the first time rather than asking a question about numbers. It'll get you to your answer faster and save people's time offering solutions to the problem that you don't actually have. If you store dates in ISO format (yyyy-mm-dd) you will be able to sort them easily. Link to comment https://forums.phpfreaks.com/topic/37888-how-to-get-the-biggest-number/#findComment-181389 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.