You need to sign in to do that
Don't have an account?

Help with a SOQL's query (SUM)
Hi,
I need to do a query in SOQL like this in SQL:
Select SUM(field1), field2 From Table Where condition Group By field2
I Know that It isn't posible, but is there a way to do something seemed?
I would like do something not to calculate this "SUM" by code.
Thanks
I need to do a query in SOQL like this in SQL:
Select SUM(field1), field2 From Table Where condition Group By field2
I Know that It isn't posible, but is there a way to do something seemed?
I would like do something not to calculate this "SUM" by code.
Thanks
Hope this helps.
- Rick Greenwald
Developer Evangelist
Hi there,
is there any way to loop through the subresult from apex?
i got a statement "select Id, (select Amount_Hrs__c from ContractQuotas__r) from contract" with multiple subrows which have to be summed up as no roll up is helpfull here. usually i'd loop through the list i get back from the query and access the fields via listname.get(position).Fieldname. But i cannot find a way to loop through the subquery-results ...
Any hint would be very helpfull. :robothappy:
the link seems to be broken or false ... am i wrong?
Done :) Very simple to loop through the subquery items to sum up something up ... wasn't that obvious too me :)