substring_index(str,delim,count) 
说明:substring_index(被截取字段,关键字,关键字出现的次数)

范例

mysql> SELECT SUBSTRING_INDEX('www.mysql.com', '.', 2);
        -> 'www.mysql'
mysql> SELECT SUBSTRING_INDEX('www.mysql.com', '.', -2);
        -> 'mysql.com'
posted on 2012-12-11 10:38  睡着的糖葫芦  阅读(233)  评论(0编辑  收藏  举报