spires Posted May 27, 2010 Share Posted May 27, 2010 HI I'm trying to get the highest number out of a database, I'm doing by: SELECT * FROM csv_tempStored ORDER by temp DESC LIMIT 1 This should take every number in the temp column, and place the numbers in descending order. However, I have all the following numbers in the temp column, but it keeps returning 9 instead of 21. 1, 2, 5, 6, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21 (they are in a random order in database) Any ideas why it's returning 9 and not 21? Thanks for your help Link to comment https://forums.phpfreaks.com/topic/203069-order-by-not-working-correct/ Share on other sites More sharing options...
Alex Posted May 27, 2010 Share Posted May 27, 2010 What datatype is the temp column? Link to comment https://forums.phpfreaks.com/topic/203069-order-by-not-working-correct/#findComment-1064054 Share on other sites More sharing options...
spires Posted May 27, 2010 Author Share Posted May 27, 2010 It's a varchar Does it need to be int? Thanks Link to comment https://forums.phpfreaks.com/topic/203069-order-by-not-working-correct/#findComment-1064078 Share on other sites More sharing options...
Alex Posted May 27, 2010 Share Posted May 27, 2010 Yes, it should be a numeric datatype. Link to comment https://forums.phpfreaks.com/topic/203069-order-by-not-working-correct/#findComment-1064130 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.