SELECT fee +
sum(((hourEnd-hourStart)*4) as sumAct3
from reserve join activity
on reserve.idactivity=activity.idactivity
join customer
on customer.idcustomer=reserve.idcustomer
where activity.typeAct=1 and customer.idcustomer='S1')
+
sum(((hourEnd-hourStart)*2) as sumAct2
from reserve join activity
on reserve.idactivity=activity.idactivity
join customer
on customer.idcustomer=reserve.idcustomer
where activity.typeAct=2 and customer.idcustomer='S1')
FROM customer
WHERE idcustomer='S1';
Ok, so every sum() returns the desired value, I already checked it but I'm having problems when trying to sum everything together and then get the total value.
Basically I have to do this:
- initial Fee(which is a set value defined on the"customer" table) + sum of activity1 cost + sum of activity2 cost == value
But I don't know how I can make it work so I get a sum of everything, I tried for a while but I always get the "SELECT is not valid at this position"