SELECT a.id, substring_index( substring_index( a.code, ',', b.help_topic_id + 1 ), ',',- 1 ) age,a.year FROM t a JOIN mysql.help_topic b ON b.help_topic_id < ( length( a.code ) - length( REPLACE ( a.code, ',', '' ) ) + 1 ) ORDER BY a.id
参考:
https://blog.csdn.net/wslzjr/article/details/108276502