sql语句有关问题

sql语句问题,高手请进
例如一个表中有多个种类的东西,每个种类又分1,2两种情况,统计每个种类这两种情况各是多少
用sql统计,有什么好的解决方案么

------解决方案--------------------
SQL code

select "种类", 
       sum(case when "子类" = '1' then 1 else 0 end) as "子类1次数",
       sum(case when "子类" = '2' then 1 else 0 end) as "子类1次数"
  from tbl 
 group by "种类";