Re: Small ORDER problem (mysql) :)
| From: | Erik Price | Date: | Wed, 08 May 2002 20:01:55 +0000 |
| Subject: | Re: Small ORDER problem (mysql) :) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-96647@lists.php.net to get a copy of this message | ||
On Wednesday, May 8, 2002, at 03:49 PM, Hawk wrote:
I have a scoreboard with results with one and two letters, the problem is when I ORDER BY score ASC the scores are 12,3,6,9 in that order.. etc.. how do I do to get them in 12,9,6,3 order?If you use the addition operator to add 0 to a string, it changes the string to a number. So you need to do something like SELECT score + 0 FROM table ORDER BY score ASC This will change your strings to numbers and they will be properly ordered by the ASC keyword. Erik ---- Erik Price Web Developer Temp Media Lab, H.H. Brown pricee@hhbrown.com