删除表中的部分字符串 [英] Remove part of string in table

查看:76
本文介绍了删除表中的部分字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张表,其中一个名为"version"的字段包含字符串"MyProgram nnnnnn". 现在,我希望替换这些字符串,以使它们仅是"nnnnnn",从而删除前面的"MyProgram".

I have a table where one field named "version" contains the string "MyProgram nnnnnn". I now wish to replace these strings so that they are only "nnnnnn", thereby remove the prepending "MyProgram ".

这有可能吗?如果可以的话,我该怎么做?

Is this possible, and if so, how would I do this?

推荐答案

如果模式是"MyProgram nnnnnn"诸如VB 1.3, Mysql 5.6, PHP 5.4等的字符串,那么您可以执行以下操作

If the pattern is "MyProgram nnnnnn" maning string like VB 1.3, Mysql 5.6, PHP 5.4 etc then you can do the following

update tablename 
set col = substring_index(col,' ',-1)

这篇关于删除表中的部分字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆