我的表的结构如下所示。
我需要编写一个查询,该查询将给出如下所示的结果:
以下是你如何做到这一点:
select number , count(*) total , count(case when status = 'fail' then 1 end) fail_count , count(case when status = 'success' then 1 end) success_count from yourtable group by number