Lets say I have a postgres table with the following data:
hostname | status
---------+--------
a1 | C
a1 | C
a1 | NC
a2 | NC
a2 | NC
a2 | C
I want to display the count of status for C and NC for each hostname, like this:
hostname | C total| NC total | Total (C+NC) | C %
---------+--------+----------+--------------+-----
a1 | 2 | 1 | 3 |66.66
a2 | 1 | 2 | 3 |33.33