SUBSTRING_INDEX()

http://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_substring-index

1 ALTER TABLE w ADD new VARCHAR(4) DEFAULT 'fruit' COMMENT '2017-01-10 14:00:26__atermelon-fruit --- fruit';
2 UPDATE w SET new=SUBSTRING_INDEX(old,'-',-1);
原文地址:https://www.cnblogs.com/rsapaper/p/6269263.html