sql

--求各院系男女生人数
select dept, sum(case when sex = '女' then 1 else 0 end) as 女生人数,
sum(case when sex = '男' then 1 else 0 end) as 男生人数 from student group by dept

posted @ 2020-10-07 15:04  叮当猫-yk  阅读(68)  评论(0编辑  收藏  举报