Home  >  Article  >  Database  >  mysql使用replace命令批量替换_MySQL

mysql使用replace命令批量替换_MySQL

WBOY
WBOYOriginal
2016-06-01 13:38:541439browse

bitsCN.com


mysql使用replace命令批量替换

 

mysql> select * from test1;

+------+---------+    

| 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)

 

bitsCN.com
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn