1 頁 (共 1 頁)

整批更新欄位裡的字串

發表於 : 2012-05-01 14:48:46
yehlu
因資料有" 造成匯出 CSV 資料位移了
解決方式將 " 改為 吋

http://topic.csdn.net/t/20041028/14/3499745.html

代碼: 選擇全部

update prod set prod_name=replace(prod_name,'"','吋')WHERE prod_name LIKE '%"%'

Re: 整批更新欄位裡的字串

發表於 : 2012-05-07 09:09:50
yehlu

代碼: 選擇全部

mysql> update cust set addr =  replace(addr,'鄉','區')  where addr like '台中縣%';
Query OK, 95 rows affected (0.01 sec)
Rows matched: 157  Changed: 95  Warnings: 0

mysql> update cust set addr =  replace(addr,'市','區')  where addr like '台中縣%';
Query OK, 51 rows affected (0.00 sec)
Rows matched: 157  Changed: 51  Warnings: 0

mysql> update cust set addr =  replace(addr,'鎮','區')  where addr like '台中縣%';
Query OK, 11 rows affected (0.01 sec)
Rows matched: 157  Changed: 11  Warnings: 0

mysql> update cust set addr =  replace(addr,'縣','市')  where addr like '台中縣%';
Query OK, 157 rows affected (0.01 sec)
Rows matched: 157  Changed: 157  Warnings: 0

Re: 整批更新欄位裡的字串

發表於 : 2012-05-07 09:12:37
yehlu

代碼: 選擇全部

mysql> update cust set addr =  replace(addr,'市','區')  where addr like '台北縣%';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> update cust set addr =  replace(addr,'台北縣','新北市')  where addr like '台北縣%';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0


Re: 整批更新欄位裡的字串

發表於 : 2015-01-08 20:09:04
aryshia
索引可以加快查尋速度,以平衡樹結構存放索引資料 .
例如: