The issue is that you're using
SUM function, this can only be used with Aggregated Queries. If so you should probably
GROUP BY result by some field and change return type of the method to
If you want just a normal query then remove
SUM from SELECT.
Here is also docs on how to use Aggregation in SOQL.
Hopefully, this helps