select category||type as grp, max(category) as cat, max(type) as typ, sum(quantity) as qty from table group by category || type