数据库中一些字段中有这些特殊符号比如
表中的数据为
mysql> select * from test3;
+----+------------+--------+
| id | name2 | name |
+----+------------+--------+
| 1 | , hello | a |
| 2 | zhongguo, | b |
| 3 | , | c |
| 4 | zeme , | d |
| 5 | skljfls, | myname |
| 6 | skfe , s | 123 |
+----+------------+--------+
现在我想把name2中的所有数据去掉【,】
这时需要使用到replace这个内置函数了。
mysql>update test3 set name2(select replace(name2,","," ") from test3);
mysql> select * from test3;
+----+------------+--------+
| id | name2 | name |
+----+------------+--------+
| 1 | hello | a |
| 2 | zhongguo | b |
| 3 | | c |
| 4 | zeme | d |
| 5 | skljfls | myname |
| 6 | skfe s | 123 |
+----+------------+--------+
ok
结果实现了,在这里我要再次谢谢 我 技术群里兄台!
表中的数据为
mysql> select * from test3;
+----+------------+--------+
| id | name2 | name |
+----+------------+--------+
| 1 | , hello | a |
| 2 | zhongguo, | b |
| 3 | , | c |
| 4 | zeme , | d |
| 5 | skljfls, | myname |
| 6 | skfe , s | 123 |
+----+------------+--------+
现在我想把name2中的所有数据去掉【,】
这时需要使用到replace这个内置函数了。
mysql>update test3 set name2(select replace(name2,","," ") from test3);
mysql> select * from test3;
+----+------------+--------+
| id | name2 | name |
+----+------------+--------+
| 1 | hello | a |
| 2 | zhongguo | b |
| 3 | | c |
| 4 | zeme | d |
| 5 | skljfls | myname |
| 6 | skfe s | 123 |
+----+------------+--------+
ok
结果实现了,在这里我要再次谢谢 我 技术群里兄台!