sql分解1,2,3,4,5,6,7,8,9,10

SELECT
	substring_index(
		substring_index(
			a.menus,
			',',
			b.help_topic_id + 1
		),
		',' ,- 1
	) id
FROM
	(SELECT menus FROM role) a
JOIN mysql.help_topic b ON b.help_topic_id < (
	length(a.menus) - length(REPLACE(a.menus, ',', '')) + 1
)

你可能感兴趣的:(Mysql)