or more directly....declare @xyz table( customer varchar(10), product1 int, product2 int, product3 int)insert into @xyzselect 'a', 1, 1, 5 union allselect 'b', 1,1,1 union allselect 'c',1,5,6 union allselect 'd', 5,6,6 union allselect 'e',1,1,1 union allselect 'a', 5,5,5select (case when customer in ('a', 'b', 'c') then 'South' else 'North' end) as Customer, count(Product1) as Product1, count(Product2) as Product2, count(Product3) as Product3from @xyzgroup by (case when customer in ('a', 'b', 'c') then 'South' else 'North' end)
Harsh AthalyeIndia."Nothing is Impossible"