select t.id,a.状态为零数,b.总数 from
(select distinct id from tb) t
(select id ,count (*) as 状态为零数 from tb where status =0 group by id) a,
(select id ,count (*) as 总数 from tb where status =0 group by id) b
where t.id=a.id(+) and t.id=b.id(+);
(select distinct id from tb) t
(select id ,count (*) as 状态为零数 from tb where status =0 group by id) a,
(select id ,count (*) as 总数 from tb where status =0 group by id) b
where t.id=a.id(+) and t.id=b.id(+);
from t group by id