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 Quote 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? Quote 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 Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.