web接口开发与自动化测试-虫师学习,此项目为书中案例。
SELECT classid , SUM(IF(gender ='男',1,0)) as '男', SUM(IF(gender ='女',1,0)) as '女' FROM student GROUP BY classid;