You can do this kind of summation in a microflow (i.e. use a Retrieve activity to get some objects, sum different fields using a List Aggregation activity, etc.). Is there a reason you need to use OQL for this?
You probably need an OQL like this:
select c.CustomerType, count(*) Ordercount, sum(o.TotalPrice) TotalSpent
from "Sales.Customer" c
join "c/Sales.Order_Customer/Sales.Order" o
group by c.CustomerType;
Modify this to meet your requirements. And if need be, you can test this on the OQL page of service.mendixcloud.com.