What about:
select substring(code, 1, 1) as letter,
substring(code, 2, 2) + 0 as number
from epost
order by 2
+--------+--------+
| letter | number |
+--------+--------+
| E | 1 |
| E | 2 |
| E | 3 |
| E | 4 |
| E | 10 |
| E | 11 |
| E | 12 |
| E | 13 |
+--------+--------+
8 rows in set (0.00 sec)
Then just use your scripting language to join the letter and number back together. I tried mysql concat() but it makes the whole thing into a wrong-sorted string again.
FWIW -- Doug
At 10:17 PM 12/12/2002 +0100, Alliax wrote:
Hi, What about if you want to sort UK Postcodes ? They can be E1,E2,..,E12,E13 Order by name would do: E1,E10,E11,E12,E13,E2,E3,E4,... how can I get with a simple ORDER BY query E1,E2,E3,E4,E5,... ?Cheers, Damien COLA --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
--------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php