2 个解决方案
#1
#2
select 月,sum(case when B.xxx='碰撞' then 1 end),sum(case when B.xxx='翻车' then 1 end),
from tb A,tb B
where A.xx=B.xx
group by 月
from tb A,tb B
where A.xx=B.xx
group by 月
#1
#2
select 月,sum(case when B.xxx='碰撞' then 1 end),sum(case when B.xxx='翻车' then 1 end),
from tb A,tb B
where A.xx=B.xx
group by 月
from tb A,tb B
where A.xx=B.xx
group by 月