1.先看是否适用:
SELECT SUBSTRING_INDEX(SUBSTRING_INDEX('11,22,33',',',help_topic_id+1),',',-1) AS num
FROM mysql.help_topic
WHERE help_topic_id < LENGTH('11,22,33')-LENGTH(REPLACE('11,22,33',',',''))+1
2.实际操作
SELECT
a.字段1,
substring_index( substring_index( a.要分割的字段2, ',', b.help_topic_id + 1 ), ',', - 1 ) AS 分割后显示的字段3
FROM
(select 字段1,要分割的字段2 from 表名) a
INNER JOIN mysql.help_topic b ON b.help_topic_id < (
length( a.要分割的字段 ) - length(
REPLACE ( a.要分割的字段, ',', '' )) + 1)
3.mysql查询某个字段不包含指定的字符:
select 字段1,字段2,字段3 from 表名 where locate('指定的字符', 查询的字段) = 0