You need conditional aggregation as follows:
select itemname, itemtype,
count(case when building = 'A' then 1 end) as totalA,
count(case when building = 'B' then 1 end) as totalB,
count(case when building = 'C' then 1 end) as totalC
from your_table
group by itemname, itemtype
order by itemname, itemtype, totalA desc, totalB desc, totalC desc
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…