SQL SERVER - GROUPING and Convert Unit of measurement
Lets say you have table: 

ProductCode ProductDescription  ProductQty
1           Apple               19
2           Banana              1
1           Apple               2
1           Apple               4
2           Banana              10
3           Clementine          8
3           Clementine          1
4           Lemon               12


Query:

Select * into #temp from (
select ProductCode, 
       ProductDescription, 
       sum(ProductQty) / 12 as Qty,
       case when (sum(ProductQty) / 12) &gt; 0 then 'BOX' else 'PACK' end Package
from Products
group by ProductCode, ProductDescription
union all
select ProductCode, 
       ProductDescription, 
       sum(ProductQty) % 12 as Qty,
       case when (sum(ProductQty) % 12) = 0 then 'No' else 'PACK' end Package
from Products
group by ProductCode, ProductDescription) as tmp

select * from #temp
where Package&lt;&gt;'No'
and Qty&lt;&gt;0
order by ProductCode


As a result I get this:

ProductCode ProductDescription  Qty Package
1           Apple               2   BOX
1           Apple               1   PACK
2           Banana              11  PACK
3           Clementine          9   PACK
4           Lemon               1   BOX


I hope this is what you are looking.