[精讚] [會員登入]

[MYSQL] String replacement

MySQL use the REPLACE function to string replacemen

分享完整連結 //n.sfs.tw/m10233

分享連結 [MYSQL] String replacement@精讚
(文章歡迎轉載,請尊重版權註明連結來源)
2017-04-05 01:21:18 By 張○○

Mysql's string replacement function "REPLACE", usage:

  REPLACE(str,from_str,to_str)

Replace matched characters, capitals and lowers are different

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

Result above WwWwWw.mysql.com

Example:

UPDATE `table_name` SET col_name=REPLACE(`col_name`, 'target_characters', 'replaced_characters')

For instance, I want to replace string "../upload/" with "upload/" in table "news" :

update `news` set `content`=replace(`content`, '../upload/', 'upload/' )

END
你可能有興趣

[地理] 澳洲柏斯的位置竟然比台灣還要西邊

這近我驚奇的發現,澳洲柏斯的精度竟然比臺灣甚至今晚還要來的西邊

WarSpotting 統計俄國在烏克蘭戰爭中到底是損失了多少軍事裝備或人員

這個網站可以看到俄羅斯在戰場上的軍事人員裝備損失,非常詳細

Mac上 vim的複製貼上不能用

在freebsd系統中發現vim裡的command+c沒辦法選取複製,但command+v可以貼上

check-host 從世界各地檢查你的網站能不能連線?

檢測你的網站能不能暢通?這個網站可讓你知道你的網站是不是「網際網路」還是「區域網路」?

[Smarty4] 出現 modifiers 函式不能用的問題

當我把smarty由3版更新到4.5.1版的時候,出現了Using unregistered function xx in a template這樣的錯誤,該如何解決?

[Docker] docker中要怎麼修改影像的名稱,rename image

透過 build來的image如果沒有指定名稱,事後要怎麼修改影像的名稱?