declare @products table(ParentProduct int, Product int, Runs int, Units int)
insert into @products
select 1, 5, 8, 6 union all
select 1, 5, 8, 6 union all
select 1, 3, 7, 10 union all
select 1, 3, 8, 10 union all
select 2, 4, 8, 5 union all
select 2, 4, 8, 5
select runs, units = sum(units)
from(
select ParentProduct, product, runs, units = sum(distinct units)
from @products
group by ParentProduct, product, runs) t
group by ParentProduct, runs