You can use a CTE to create different grouped data which you then merge. You can also group by different things in the same query by using OVER as in
select count(item1) over (group by id) as byId, count(item1) over (group by name) as byName from myTable