Have a list of SUP failure computers, and trying to do a report counting how many of the computers are in which OU (to see if Discovery or Boundary issue).
Report is picking up the MAX OU correctly, but, not grouping the computer count (getting a single row per each computer). Not sure what I'm doing wrong--anyone have a clue?
Thanks.
SELECT (select top 1 SOU2.System_OU_Name0 from dbo.v_RA_System_SystemOUName SOU2 where SOU.ResourceID = SOU2.ResourceID and LEN(SOU2.System_OU_Name0) = MAX(LEN(SOU.System_OU_Name0))) AS 'OU' , COUNT(DISTINCT SOU.ResourceID) AS 'COUNT' FROM dbo.v_RA_System_SystemOUName SOU JOIN dbo.v_R_System SYS ON SYS.ResourceID = SOU.ResourceID WHERE SYS.Netbios_Name0 IN ( 'PHO-PVR63186', 'WCO-PVP11579', 'PAL-PVI82336', 'LOM-PVI46044', 'LOM-PVI49102', 'LOM-PVR46148', 'PUG-PVI92643', 'RED-PVI54875', 'REN-PVR27553', 'WLA-PVR125834') GROUP BY SOU.ResourceID ORDER BY 'OU'