简单。Select 班级, count(*) as 总数, Sum(Case when 性别='1' then 1 else 0 end) as 男, --假设1男 2女 Sum(Case when 性别='2' then 1 else 0 end) as 女, Sum(Case when 学籍状态='休学' then 1 else 0 end) as 休学, Sum(Case when 学籍状态='退学' then 1 else 0 end) as 退学, Sum(Case when 学籍状态='开除' then 1 else 0 end) as 开除, Sum(Case when 学籍状态='正常' then 1 else 0 end) as 正常From 表1group by 班级