select case when tmp.f1=v1 then .....else 0 end as ..., case when 实现
select sum(case when f0 = ... and f1 = 'v1' then 1 else 0 end) , sum(case when f0 = ... and f2 = 'v2' then 1 else 0 end) , sum(case when f0 = ... and f3 = 'v3' then 1 else 0 end) , ... from table1
case when 实现
sum(case when f0 = ... and f1 = 'v1' then 1 else 0 end) ,
sum(case when f0 = ... and f2 = 'v2' then 1 else 0 end) ,
sum(case when f0 = ... and f3 = 'v3' then 1 else 0 end) ,
...
from table1