SQL集合函数中使用case when then
SELECT sex, COUNT(Case province when '广东省' then '广东省' end) as '广东省', COUNT(Case province when '江西省' then '江西省' end) as '江西省', COUNT(Case province when '浙江省' then '浙江省' end) as '浙江省' From Case_Test2 group by sex
SELECT sex, COUNT(Case province when '广东省' then '广东省' end) as '广东省', COUNT(Case province when '江西省' then '江西省' end) as '江西省', COUNT(Case province when '浙江省' then '浙江省' end) as '浙江省' From Case_Test2 group by sex