select
CS.Name0,
PSE.Status0,
count(PSE.Status0)
from
dbo.v_GS_Computer_System cs left outer join dbo.v_GS_PATCHSTATEEX PSE on CS.ResourceID = PSE.ResourceID
left outer join dbo.v_GS_SYSTEM S on CS.ResourceID = S.ResourceID
Where
S.SystemRole0 = ‘Server’
Group by
CS.Name0,
PSE.Status0