经测试是正确的,可以参考
--查询出每个科目对应着那些学生
select c.ci_id cid,s.stu_name sname,instr(c.stu_ids,s.stu_id)
from pm_ci c,pm_stu s where instr(c.stu_ids,s.stu_id)<>0
--将上面的查询结果作为表进行分组查询,显示为想要的结果
select b1.cid,wm_concat(b1.sname) from
(select c.ci_id cid,s.stu_name sname,instr(c.stu_ids,s.stu_id)
from pm_ci c,pm_stu s where instr(c.stu_ids,s.stu_id)<>0) b1 group by b1.cid;