星期二, 5月 31, 2005

[db][mysql]

取代字串函式

REPLACE(str,from_str,to_str)

例子:

mysql> SELECT REPLACE('www.mysql.com', 'w', 'Ww');
-> 'WwWwWw.mysql.com'

This function is multi-byte safe.

update table set field = replace( field , 'targetStr' , 'replaceToStr') where field like 'condition';

沒有留言: