Mysql replace将表中的某个字段出现的指定值替换为另一个值

replace(object,search,replace)

将sysshop_store表中area_code字段出现的1,全部替换为空

UPDATE sysshop_store SET area_code=replace(area_code,'1,','') WHERE `area_code` REGEXP '^1,' ;

REGEXP 匹配正则表达式,这里的where条件是area_code字段中 1, 开头的数据

发布了36 篇原创文章 · 获赞 4 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/m0_37826705/article/details/100118169
今日推荐