update tablename set url=replace(url,'A/', ' uploads/') where url like '%img%'; update tablename set url=replace(url,'A/', ' uploads/') where id not in( select id fromt tablename where url like '%img%'); 希望我的回答对你有帮助,谢谢。
SELECT REPLACE(url, 'A/', 'upload/') FROM $TABLE WHERE url LIKE '%img%';SELECT REPLACE(url, 'A/', 'upload/') FROM $TABLE WHERE url NOT LIKE '%img%'另外可以看看 MySQL的REGEXP 关键字PHP实战QQ群: 33918040
SELECT REPLACE(url, substr(url,0,2), 'upload/') FROM $TABLE WHERE url LIKE '%img%';SELECT REPLACE(url, substr(url,0,2), 'upload/') FROM $TABLE WHERE url NOT LIKE '%img%'
update tablename set url=replace(url,'A/', ' uploads/') where id not in( select id fromt tablename where url like '%img%');
希望我的回答对你有帮助,谢谢。
SELECT REPLACE(url, 'A/', 'upload/') FROM $TABLE WHERE url LIKE '%img%';SELECT REPLACE(url, 'A/', 'upload/') FROM $TABLE WHERE url NOT LIKE '%img%'另外可以看看 MySQL的REGEXP 关键字PHP实战QQ群: 33918040
SELECT REPLACE('A/A/A/xxx', 'A/', 'upload/')upload/upload/upload/xxx
2、将url字段记录中不包含有img字符串的数据查询出来,并且将记录中的 A/ 替换成 uploads/. 都是将 A/ 换成 upload/ 吗 ?直接select 'upload/'.substr(url,3,length(url)-2) from mytable