请问 怎样从上面的数据表中查询出下面表的效果?求大神指教
group by month
select months 月份,type1+type2+type3 总数
,case when type1>0 then 1 else 0 then 执照1
,case when type2>0 then 1 else 0 then 执照2
,case when type3>0 then 1 else 0 then 执照3
from(
select yeas,months
,case when licenseType=1 then counts else 0 end type1
,case when licenseType=2 then counts else 0 end type2
,case when licenseType=3 then counts else 0 end type3
from 表
) a