列の5番目の文字を最後から変更する必要があります。
例えば、
- path / of / images / 1232323_
m
.jpg
に
- path / of / images / 1232323_
b
.jpg
MySQLクエリを使用してそれを行う方法は?
update your_table
set col = concat(substring(col, 1, length(col) -5), 'b', substring(col, -4))
where length(col) > 5 --if you really need.
どうですか
update your_table
set col = replace(col, 'm.jpg', 'b.jpg')
小切手
select col, if(length(col)<5,col,concat(substr(col,1,length(col)-5),'X',substr(col,length(col)-3,5))) from table;
それに基づいて更新を実行します。
update table set col=concat(substr(col,1,length(col)-5),'X',substr(col,length(col)-3,5)) where length(col)>5;