Hello,
I have a query that is returning rows that need to be ordered by an ID that holds one or two characters.
the IDs are A, B, C, D,.... X, Y, Z, AA, BB, CC ...
Is there a way i can order this in the order shown above without creating another table and using numerical keys to associate those values. Currently the order is A, AA, B, BB, C, CC.....
Thanks for any help!
Will
Order By using characters.. [Solved]
Moderator: General Moderators
-
waskelton4
- Forum Contributor
- Posts: 132
- Joined: Mon Sep 09, 2002 6:42 pm
Order By using characters.. [Solved]
Last edited by waskelton4 on Thu May 05, 2005 1:51 pm, edited 1 time in total.
If you are using MySQL, you could try something like:
Code: Select all
SELECT CHAR_LENGTH(name) AS length, *
FROM table
ORDER BY length ASC, name DESC-
waskelton4
- Forum Contributor
- Posts: 132
- Joined: Mon Sep 09, 2002 6:42 pm
Order By using characters. [solved]
Perfect..
Thanks!!
Thanks!!