mysql使用replace命令批量替換
mysql> select * from test1;
+------+---------+ www.2cto.com
| id | name |
+------+---------+
| 1 | aaaKaaa |
| 2 | bbbKbbb |
| 3 | cccKccc |
+------+---------+
3 rows in set (0.00 sec)
mysql> update test1 set name=replace(name,'K','211.99.224.138');
Query OK, 3 rows affected (0.01 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> select * from test1;
+------+----------------------+
| id | name |
+------+----------------------+
| 1 | aaa211.99.224.138aaa |
| 2 | bbb211.99.224.138bbb |
| 3 | ccc211.99.224.138ccc |
+------+----------------------+
3 rows in set (0.00 sec)