Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
|
You would better start a new thread for your question, rather than overloading this one.
Anyway, for that ( and depending of your DB), you will need to cast your column type from string to number.
It depends of your db, so check you documentation, but once you do the cast to numeric, and strip every non numeric character, an ASC or DESC sort order will do the trick.
I just checked in mysql5, and this DB does the cast itself, it seems:
Code:
mysql> create table sandbox( txt varchar(20) );
Query OK, 0 rows affected (0.02 sec)
mysql> insert into sandbox values ('100$');
Query OK, 1 row affected (0.00 sec)
mysql> insert into sandbox values ('1000$');
Query OK, 1 row affected (0.00 sec)
mysql> insert into sandbox values ('1050$');
Query OK, 1 row affected (0.00 sec)
mysql> select * from sandbox order by txt desc;
+-------+
| txt |
+-------+
| 1050$ |
| 1000$ |
| 100$ |
+-------+
3 rows in set (0.00 sec)
mysql>
__________________
Only a biker knows why a dog sticks his head out the window.
|