Home > Database > Mysql Tutorial > mysql查询字符串替换语句小结(数据库字符串替换)_MySQL

mysql查询字符串替换语句小结(数据库字符串替换)_MySQL

WBOY
Release: 2016-06-01 13:22:56
Original
1148 people have browsed it

bitsCN.com 将ubk_vhost_list表中的字段userid中的字符10005替换成10010

UPDATE `table_name` SET `field_name` = replace (`field_name`,'from_str','to_str') WHERE `field_name` LIKE '%from_str%'

说明:
table_name ―― 表的名字
field_name ―― 字段名
from_str ―― 需要替换的字符串
to_str ―― 替换成的字符串

今天运行了一个查询
UPDATE ubk_vhost_list SET userid = replace (userid,'10005','10010')

比较详细的mysql字符串替换语句可以参考下面的文章bitsCN.com

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template