select case
when XML LIKE '%STATUS="NEW"%' then 'NEW Docs'
when XML LIKE '%STATUS="OLD"%' then 'OLD Docs'
end as GroupName,
SUM(Size) as Size1,
count(*) as Total
from contents
Where (XML LIKE ('%STATUS="NEW"%') OR (XML LIKE '%STATUS="OLD"%' ))
Group by
case
when XML LIKE '%STATUS="NEW"%' then 'NEW Docs'
when XML LIKE '%STATUS="OLD"%' then 'OLD Docs'
end
order by Size1, Total
------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/