Fai i calcoli direttamente sulla query

codice:
select data,sum(prezzo) as totale
from tabella
group by data
order by data