This question already has an answer here:
这个问题在这里已有答案:
- MySQL string replace 5 answers
MySQL字符串替换5个答案
I have these values for each record in a column :
我为列中的每条记录都有这些值:
http://192.168.106.82/bookclub/uploads/booktype/01_type_education.png
http://192.168.106.82/bookclub/uploads/booktype/02_type_religion.png
http://192.168.106.82/bookclub/uploads/booktype/03_type_technology.png
http://192.168.106.82/bookclub/uploads/booktype/04_type_business.png
http://192.168.106.82/bookclub/uploads/booktype/05_type_healthy.png
http://192.168.106.82/bookclub/uploads/booktype/06_type_magazine.png
http://192.168.106.82/bookclub/uploads/booktype/07_type_literature.png
Then I want to modify IP Address 192.168.106.82 to other such as 192.168.1.39 Can I modify all of these in one time?
然后我想修改IP地址192.168.106.82到其他如192.168.1.39我可以一次修改所有这些吗?
2 个解决方案
#1
1
You can do with update
你可以做更新
UPDATE your_table
SET your_field = REPLACE(your_field, '192.168.106.82', ' 192.168.1.39')
WHERE your_field LIKE '%192.168.106.82%'
#2
0
You can use functions in UPDATEs' SET clauses, like so:
您可以在UPDATE的SET子句中使用函数,如下所示:
UPDATE table
SET field = REPLACE(field, 'old value', 'new value')
WHERE condition
To update the entire table, you would either leave the WHERE clause off entirely, or set a condition that cannot be false (some server configs prevent WHEREless updates).
要更新整个表,您可以完全关闭WHERE子句,也可以设置不能为false的条件(某些服务器配置会阻止WHEREless更新)。
#1
1
You can do with update
你可以做更新
UPDATE your_table
SET your_field = REPLACE(your_field, '192.168.106.82', ' 192.168.1.39')
WHERE your_field LIKE '%192.168.106.82%'
#2
0
You can use functions in UPDATEs' SET clauses, like so:
您可以在UPDATE的SET子句中使用函数,如下所示:
UPDATE table
SET field = REPLACE(field, 'old value', 'new value')
WHERE condition
To update the entire table, you would either leave the WHERE clause off entirely, or set a condition that cannot be false (some server configs prevent WHEREless updates).
要更新整个表,您可以完全关闭WHERE子句,也可以设置不能为false的条件(某些服务器配置会阻止WHEREless更新)。