如图,要把price字段的只保留数值,去掉单位 元/斤,
如果要去除字段左边的:执行以下语句
update vegetable set vegetable.price=right(vegetable.price,char_length(vegetable.price)-1) where left(vegetable.price,1) not in ('0','1','2','3','4','5','6','7','8','9');
如果要去除字段右边的:执行以下语句
update vegetable set vegetable.price=left(vegetable.price,char_length(vegetable.price)-1) where right(vegetable.price,1) not in ('0','1','2','3','4','5','6','7','8','9');
注意每次执行,只能去掉一位字符,去掉元/斤,需要执行3次
执行如下图: