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 ) 

 

展示效果:

 

posted on 2022-09-16 15:09  梦寐以求じ  阅读(977)  评论(0)    收藏  举报