select stuNum,
(select name from student1 m where id = '1' and m.stuNum = student1.stuNum) as a,
(select name from student1 m where id = '2' and m.stuNum = student1.stuNum) as b,
(select name from student1 m where id = '3' and m.stuNum = student1.stuNum) as c
from student1 GROUP BY stuNum
这条sql查询出来的结果如下
这里只能查询一个字段