开发者

replacing value of a column(unknown length) with substring

How can I replace the value(unknown length) of a column in mySQL workbench with a substring that exists in that column?

For ex:

If I have the value of a column like "ABC.123.Chrome/123", how do I replace this for all rows with just "Chrome/123"? I want to replace value in that string of unknown length with everything that comes after C开发者_运维知识库hrome only.


This should work if you want to include Chrome:

UPDATE MyTable 
SET ColumnName = SUBSTRING(ColumnName,LOCATE('Chrome'))
WHERE ColumnName LIKE '%Chrome%'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜