查找数据长度为3的姓名
select char_length("张三"); -- 2
select distinct name from db.table where char_length(name) = 3;
批量将姓名"张三"替换"张x"
update db.table set name=insert(name, 2, 1, 'x') where char_length(name) = 3;
select char_length("张三"); -- 2
select distinct name from db.table where char_length(name) = 3;
update db.table set name=insert(name, 2, 1, 'x') where char_length(name) = 3;
本文标题:Mysql查找指定字符串长度数据并替换
本文链接:https://www.haomeiwen.com/subject/wpkoartx.html
网友评论