我的数据库中有一些条目要从斜杠char中清除,如下所示:
text-/-moreText
我想升级到:
text-moreText
我试过了:
SELECT * FROM myTable WHERE `column` LIKE BINARY '%\/%'
此查询适用于以下字符:但不包含/
答案 0 :(得分:0)
replace()应该可以做到
update
myTable
set col = replace(col,'/','');
mysql> select replace('text-/-moreText','/','');
+-----------------------------------+
| replace('text-/-moreText','/','') |
+-----------------------------------+
| text--moreText |
+-----------------------------------+
1 row in set (0.00 sec)
mysql> select replace('text--moreText','/','');
+----------------------------------+
| replace('text--moreText','/','') |
+----------------------------------+
| text--moreText |
+----------------------------------+
1 row in set (0.00 sec)