Mathias wrote:

you didn't give an alternative, but i've forgotten just a '^' :

mysql> SELECT * FROM names ORDER BY REPLACE(name,'^The ','');

No, sorry -- that doesn't work at all; REPLACE takes a string,
not a regex. Look at your example below: 'The AAAA' should be
after 'AAAA'; 'ZZZZ' should be before 'The ZZZZ'. And so on.
+----------------+
| name           |
+----------------+
| AAAA           |
| AAAA           |
| BBBB           |
| GGGG           |
| GGGG The Yeti  | <==== Rigth order
| GGGG Xylophone |
| GGGG Zyxel     |
| The AAAA       |
| The AAAA       |
| The ZZZZ       |
| The ZZZZ       |
| ZZZZ           |
+----------------+

Quick test: SELECT REPLACE(name,'^The ','woohoo') FROM names; -- :-)

--
Hassan Schroeder ----------------------------- [EMAIL PROTECTED]
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                          dream.  code.



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

Reply via email to