JohneeMac Posted September 29, 2007 Share Posted September 29, 2007 Hi. I have a little league table integrated at www.afc-chat.co.uk It doesnt seem to the rows in the right order. MySQL is SELECT * FROM leaguetable ORDER BY points DESC, gd DESC As you will see i want the data ordered by points then by goal difference (gd). I have tried both ASC and DESC and they work when the numbers invert by being either positive or negative, but changing that manually obviously isnt the right way to do things. The database is entered into the database by a single field like: "+10" or "-4". Maybe its the input i need to change? Any help greatly appreciated. JM. Quote Link to comment https://forums.phpfreaks.com/topic/71153-solved-mysql-not-reading-and-plus-numbers-correctly/ Share on other sites More sharing options...
btherl Posted September 29, 2007 Share Posted September 29, 2007 What data type are those columns? If they are varchar or char then you will need to convert them to integers each time you order, which can be done like this: SELECT * from leaguetable ORDER BY point + 0 DESC, gd + 0 DESC Quote Link to comment https://forums.phpfreaks.com/topic/71153-solved-mysql-not-reading-and-plus-numbers-correctly/#findComment-357888 Share on other sites More sharing options...
JohneeMac Posted September 30, 2007 Author Share Posted September 30, 2007 My own silly fault, setting the field to an integer worked. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/71153-solved-mysql-not-reading-and-plus-numbers-correctly/#findComment-358300 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.