比如,在表test中,字段notice中,每一行记录不知道为什么都加了,“消息: ”,现在要去除“消息: ”字符。 因为前面的字符一样,所以可以批量把前两个字母去掉就可以了。 update test set notice=replace(notice,'消息:','') where notice like '消息:%'; 如果表前8个字符并不一样,那么就需要使用如下语句了: update test set notice=substring(notice,9,len(notice)); 这是去掉前8个字符的,如果需要去掉8位或更多字符那么修改下相应的数字就可以了。 转载请保留固定链接: https://linuxeye.com/database/354.html |