clear markdown compare help best fiddles feedback dbanow.uk a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 1130760 fiddles created (16571 in the last week).

create table #Order (OrderId varchar(10), Supplier varchar(10), Channel varchar(10) ) INSERT INTO #Order(OrderID,Supplier,Channel) VALUES('1','Supp1','Paper') ,('2','Supp1','Paper') ,('3','Supp 3','Paper') ,('4','Supp 4','Paper') ,('5','Supp 5','Paper') ,('6','Supp 8','Inter') ,('7','Supp 6','Inter') ,('13','Supp 30','aa') ,('14','Supp 44','aa') ,('15','Supp 7','aa') ,('55','Supp 5','aa') SELECT ISNULL(O.Channel,'Total Distinct Supp') as Channel ,COUNT(Distinct Supplier) as SupplierCount FROM #Order AS O INNER JOIN ( SELECT Channel , COUNT(DISTINCT Supplier) AS [SupplierCount] FROM #Order as O GROUP BY Channel HAVING COUNT(Distinct Supplier)>2 )C ON o.Channel = C.Channel GROUP BY GROUPING SETS ((O.Channel), ()) ORDER BY ISNULL(O.Channel,'Total Distinct Supp');
Channel SupplierCount
aa 4
Paper 4
Total Dist 7
 hidden batch(es)