/**单选统计**/
SELECT syyou,count(syyou) from test_form_one group BY syyou/**复选统计**/
select substring_index(substring_index(a.race,'|',b.help_topic_id+1),'|',-1) as race,count(substring_index(substring_index(a.race,'|',b.help_topic_id+1),'|',-1))
from test_form_one a
join mysql.help_topic b
on b.help_topic_id < (length(a.race) - length(replace(a.race,'|',''))+1)
group BY substring_index(substring_index(a.race,'|',b.help_topic_id+1),'|',-1)
order by a.id;
截取的核心语句为:
select substring_index(substring_index(a.race,'|',b.help_topic_id+1),'|',-1) from test_form_one a
join mysql.help_topic b
on b.help_topic_id < (length(a.race) - length(replace(a.race,'|',''))+1)
order by a.id;
参考的文件地址:http://www.cnblogs.com/cenalulu/archive/2012/08/20/2647463.html