Come on. You have written aggregated queries before.DECLARE @Sample TABLE ( rowID INT IDENTITY(1, 1) PRIMARY KEY CLUSTERED, [xml] XML )INSERT @SampleSELECT '<stringList xmlns="http://schemas.myCompany.com/myProject/[app]/stringList/1.0"><value>value1</value></stringList>' UNION ALLSELECT NULL UNION ALLSELECT '<stringList xmlns="http://schemas.myCompany.com/myProject/[app]/stringList/1.0"><value>value5</value><value>value2</value></stringList>' UNION ALLSELECT '<stringList xmlns="http://schemas.myCompany.com/myProject/[app]/stringList/1.0"><value>value4</value><value>value1</value><value>value5</value><value>value2</value></stringList>'SELECT *FROM @Sample;WITH XMLNAMESPACES('http://schemas.myCompany.com/myProject/[app]/stringList/1.0' AS theYak)SELECT myValue, COUNT(*) AS ItemsFROM ( SELECT t.c.value('.', 'VARCHAR(20)') AS myValue FROM @Sample AS s CROSS APPLY s.xml.nodes('/theYak:stringList/theYak:value') AS t(c) ) AS dGROUP BY myValue
E 12°55'05.63"N 56°04'39.26"