count(case when d.detail = 'good' then 1 end) as good, count(case when d.detail = 'ok' then 1 end) as ok, count(case when d.detail = 'bad' then 1 end) as bad ...
This will be quite useful in showing aggregations using pivot tables. These aggregations are better suited to doing visualizations anyway. And to make sure the crosstab query is up-to-date and ...