title: Aggregate and sum using Core Data
body: <p>I have two entities:</p>
  
  <ul>
  <li>Invoices</li>
  <li>Customers</li>
  </ul>
  
  <p>I want to get the sum of invoices grouped by customers.</p>
  
  <p>After reading some web pages, tutorials, and Apple documentation, it is not clear to me what will be the better approach, using Core Data.</p>
  
  <p>The current solution that works for me, is fetching all customers, and for each one, fetch again only the sum of invoices. Even it is working perfectly, I do not like as a definitive solution.</p>
  
  <p>Maybe using the NSExpressionDescription would be a better approach, but really I do not understand it well enough to use it.</p>
  
  <p>I know Core Data is not a database, and in plain SQL this is really easy, but I am using Core Data :-)</p>
  
  <p>Any advice will be appreciate :-)</p>
  
  <p>thanks,</p>
  
  <p>ps. I have the Marcus Zarra Core Data book but can not find a solution/guidance there </p>