使用笛卡尔积完成数据库单字段逗号分隔字符串数据的拆分
SELECT a.`answer_result_id`,SUBSTRING_INDEX(SUBSTRING_INDEX(a.`answer`,',',b.help_topic_id+1),',',-1)answer,single_subject_score,subject_id
FROM
`exam_manage_answer_result` a
JOIN
mysql.help_topic b
ON b.help_topic_id < (LENGTH(a.`answer`) - LENGTH(REPLACE(a.`answer`,',',''))+1)
ORDER BY a.`answer_result_id`;
每天努力一点点!