Mysql 查询字段分割

将Name字段以逗号分隔展示
SELECT Id, substring_index( substring_index( a.Name, ',', b.help_topic_id + 1 ), ',',- 1 ) AS Name
FROM test a JOIN mysql.help_topic b
ON b.help_topic_id < (length( a.Name ) - length( REPLACE ( a.Name, ',', '' ) ) + 1 )
展示效果:

浙公网安备 33010602011771号