codice:
select categoria,sum(prezzo*quantita) as totale
from tabella
group by categoria