Hi

> this,among other answers, can be done :
>
> mysql> select * from names;
> +----------+
> | name     |
> +----------+
> | AAAA     |
> | The AAAA |
> | ZZZZ     |
> | The ZZZZ |
> | BBBB     |
> +----------+
> 5 rows in set (0.02 sec)
> 
> mysql> select * from names order by replace(name,'The ','');
> +----------+
> | name     |
> +----------+
> | AAAA     |
> | The AAAA |
> | BBBB     |
> | ZZZZ     |
> | The ZZZZ |
> +----------+
> 5 rows in set (0.00 sec)
> 

Hmm...
Disanvantage of such way is replacing of 'The ' substring
in *ANY* place of field, not just at the beginning of it. :(

Look here:

mysql> SELECT * FROM names;
+----------------+
| name           |
+----------------+
| AAAA           |
| The ZZZZ       |
| GGGG           |
| GGGG The Yeti  |
| The AAAA       |
| GGGG Xylophone |
| GGGG Zyxel     |
+----------------+
7 rows in set (0.00 sec)

mysql> SELECT * FROM names ORDER BY REPLACE(name,'The ','');
+----------------+
| name           |
+----------------+
| AAAA           |
| The AAAA       |
| GGGG           |
| GGGG Xylophone |
| GGGG The Yeti  | <--- must be earlier :)
| GGGG Zyxel     |
| The ZZZZ       |
+----------------+
7 rows in set (0.00 sec)

-- 
wbr, sergey v. spivak
sergey#spivak.kiev.ua
zlob-uanic/eunic/ripe

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to