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);

 

posted @ 2017-01-10 14:33  papering  阅读(174)  评论(0编辑  收藏  举报