字符: P001/(P002+P003+P004+P005-P006+P007)
怎么拆分这个字符并得出它的层级,最终想要的结果是想按照数学运算给出层级这样的
level name
1 P002
1 P003
1 P004
1 P005
1 P006
1 P007
2 P001
数据符号给出层级??为什么p001是2级?没有明白
SELECT
SUBSTRING_INDEX(SUBSTRING_INDEX( a.`name`, ',', b.help_topic_id + 1 ), ',',-1 ) name
FROM
(select replace(replace(replace(replace('(1+2)-(3+4*6)','+',','),'-',','),'*',','),'/',',') as name) a
JOIN mysql.help_topic b ON b.help_topic_id < ( LENGTH( a.`name`) - LENGTH( REPLACE ( a.`name`, ',', '' ) ) + 1 );