核心语句:
UPDATE `cdb_pms` SET `subject` = REPLACE(`subject`, 'Welcome to', '欢迎光临')
mysql替换字段里数据内容部分字符串
mysql替换表的字段里面内容,如例子:
mysql> select host,user from user where user='testuser';
+-----------------------+----------+
| host | user |
+-----------------------+----------+
| localhost.localdomain | testuser |
+-----------------------+----------+
update字段host的内容,把"main"改成"slave",用REPLACE
mysql> update user set host=REPLACE(host,'main','slave') where user='testuser';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select host,user from user where user='testuser';
+------------------------+----------+
| host | user |
+------------------------+----------+
| localhost.localdoslave | testuser |
+------------------------+----------+
由查询结果到,数据已经更新成功
因为服务器上安了一流拦截系统,所以dede的交替功能不好使.只能手动在phpadmin中SQL:
update dede_addonarticle set body=replace(body ,'大法','方法')
mysql替换表的字段里面内容,如例子:
mysql> select id,type from items limit 10;
+--------+--------+
| id | type |
+--------+--------+
| 0001 | 780000 |
| 0002 | 780000 |
| 0003 | 780000 |
| 0004 | 780000 |
| 0005 | 780000 |
| 150419 | 780000 |
| 150420 | 780000 |
| 150421 | 780000 |
| 150422 | 780000 |
| 150423 | 780000 |
+--------+--------+
把type字段中的“78”改成“79” 用replace函数
sql如下:
mysql> update items set type=replace(type,'79','78');
Query OK, 17536 rows affected (0.72 sec)
Rows matched: 17536 Changed: 17536 Warnings: 0
再查询:
mysql> select id,type from items limit 10;
+--------+--------+
| id | type |
+--------+--------+
| 0001 | 790000 |
| 0002 | 790000 |
| 0003 | 790000 |
| 0004 | 790000 |
| 0005 | 790000 |
| 150419 | 790000 |
| 150420 | 790000 |
| 150421 | 790000 |
| 150422 | 790000 |
| 150423 | 790000 |
+--------+--------+
10 rows in set (0.00 sec)
由查询结果到,数据已经更新成功
MYSQL,批量替换
更新日志
- 小骆驼-《草原狼2(蓝光CD)》[原抓WAV+CUE]
- 群星《欢迎来到我身边 电影原声专辑》[320K/MP3][105.02MB]
- 群星《欢迎来到我身边 电影原声专辑》[FLAC/分轨][480.9MB]
- 雷婷《梦里蓝天HQⅡ》 2023头版限量编号低速原抓[WAV+CUE][463M]
- 群星《2024好听新歌42》AI调整音效【WAV分轨】
- 王思雨-《思念陪着鸿雁飞》WAV
- 王思雨《喜马拉雅HQ》头版限量编号[WAV+CUE]
- 李健《无时无刻》[WAV+CUE][590M]
- 陈奕迅《酝酿》[WAV分轨][502M]
- 卓依婷《化蝶》2CD[WAV+CUE][1.1G]
- 群星《吉他王(黑胶CD)》[WAV+CUE]
- 齐秦《穿乐(穿越)》[WAV+CUE]
- 发烧珍品《数位CD音响测试-动向效果(九)》【WAV+CUE】
- 邝美云《邝美云精装歌集》[DSF][1.6G]
- 吕方《爱一回伤一回》[WAV+CUE][454M]