title: Entity Framework - Group By Sum
body: <p>This is a relatively new area for me. I have two entities: <code>Inquiries</code> and <code>Categories</code>.</p>
  
  <p>Each <code>Inquiry</code> has a category and a property indicating an integer value (called <code>TotalTimeSpent</code>), and each category has multiple inquiries.</p>
  
  <p>What I want to do is generate a view that is grouped by categories while summing all the inquiries in that one category.</p>
  
  <p>My code at the moment is:</p>
  
  <pre><code>var catgroup = db.CATEGORies.GroupBy(i =&gt; i.CATNAME).Sum(c =&gt; c.)
  </code></pre>
  
  <p>Obviously each grouping has multiple inquiries in it, so when I am doing the c=> c. it is not bringing back the property that I need to sum with only the group extensions (like <code>FirstOrDefault</code>).</p>
  
  <p>How do I continue from here so I can sum <code>TotalTimeSpent</code> for each inquiry based on the above grouping?</p>