why not use the "group by" ans sum(_) is the select part of the statment

select sum(_)
from ___
where ___
grou by ___