Re: Ordering a text field
| From: | 1LT John W. Holmes | Date: | Thu, 14 Nov 2002 21:41:23 +0000 |
| Subject: | Re: Ordering a text field | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-124503@lists.php.net to get a copy of this message | ||
> I'm running a mysql query with the ORDER BY clause, the problem is that
> the column that I'm running them on is type tinytext. The data are
> product numbers, most of which are numbers, but some are like "404R" or
> whatever else. So if my values are 403, 404R,405, 4150 - the order ends
> up being:
> 403
> 4150
> 404R
> 405
You'll have to make them numbers, which can be done by adding zero to it. As
long as your letters are only at the end of the numbers, it'll work...
ORDER BY 0+column
404R will be 404, but 4R04 would become 4. You lose everything after the
first letter.
---John Holmes...