ianp Posted August 20, 2012 Share Posted August 20, 2012 I have this "SELECT * FROM servers WHERE status='Online' ORDER BY `bid` DESC"; but it outputs the order like this What am I doing wrong? row 1:bid:400 row 2:bid:9402 row 3:bid:320 Quote Link to comment https://forums.phpfreaks.com/topic/267344-sql-ordering-incorrectly/ Share on other sites More sharing options...
Maq Posted August 20, 2012 Share Posted August 20, 2012 Can you show us some sample data and table structure? What data type is column 'bid'? Quote Link to comment https://forums.phpfreaks.com/topic/267344-sql-ordering-incorrectly/#findComment-1370854 Share on other sites More sharing options...
ianp Posted August 20, 2012 Author Share Posted August 20, 2012 I just figured it out, it was TEXT and I changed it to INT. Quote Link to comment https://forums.phpfreaks.com/topic/267344-sql-ordering-incorrectly/#findComment-1370856 Share on other sites More sharing options...
Christian F. Posted August 20, 2012 Share Posted August 20, 2012 Saving integers in a varchar field leads to that problem, yes. Quote Link to comment https://forums.phpfreaks.com/topic/267344-sql-ordering-incorrectly/#findComment-1370857 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.