Select A,count(B) as total,sum(case when B > 30 then 1 else 0 end) as total1,sum(case when B > 20 then 1 else 0 end) as total2 from ABC group by A
去看帮助文档