例子:

1.select   tm.line_name , substring_index(tm.line_name, '-', -1) as stop_name  from

line_name :北门车站-三台

'-':分隔符

-1:取分割符后所有字符串

 

 

知识点:

1、substring_index(str, delim, count) 方法

str:需要拆分的字符串;

delim:分隔符,根据此字符来拆分字符串;

count:当 count 为正数,从左到右数,取第 n 个分隔符之前的所有字符; 当 count 为负数,从右往左数,取倒数第 n 个分隔符之后的所有字符

 

posted on 2020-08-05 11:51  爱吃萝卜青菜  阅读(3154)  评论(0)    收藏  举报