As mentioned in the question, I gave both outputs for the expected
declare @t table (Id int,Shop varchar(10),PCname varchar(10),OS Varchar(10)) insert into @t (Id,Shop,PCname,os)values (1,'Mineski','M101','WinXP'), (2,'Mineski','M102','WinXP'),(3,'GameCity','G201','Win7'), (4,'GameCity','G202','Win7'),(5,'CyberBob','C301','WinXP'), (6,'CyberBob','C302','Win7')
First result
;with cte as ( select shop,OS,ROW_NUMBER()OVER(PARTITION BY shop,OS ORDER BY shop ) rn from @t) select shop,OS from cte where rn = 1
And the final set of results
;with cte as ( select shop,OS,ROW_NUMBER()OVER(PARTITION BY shop,OS ORDER BY shop ) rn from @t) ,CTE2 AS ( Select shop,CASE WHEN R = 1 THEN 'MIXED' ELSE OS END AS 'OS' from ( select shop,OS,count(rn)R from cte group by Shop,OS )S ) select DISTINCT shop,OS from CTE2