Calculating a simple sum with Core Data

Viewed 7141

I have a simple Core Data store with an entity Cost with an integer property "value". I want to sum up all amounts of the costs in my store, which is equivalent to the following sql statement:

SELECT sum(value) FROM costs

How do I do it the most efficient way in Cocoa Touch? By using Core Data? Or just get all cost entities and do the summation manually?

3 Answers
Related