title: Using LINQ to SELECT the SUM() of a subquery
body: <p>I am trying to learn how to use LINQ to perform a query that yields the same result as this:</p>
  
  <pre><code>SELECT (
    SELECT SUM(point)
    FROM communitymemberpointfeature
    WHERE communitymemberpointfeature.communitymemberid = communitymember.id
  ) AS points, communitymember.*
  FROM communitymember
  </code></pre>
  
  <p>After browsing around the Internet, I constructed the following statement:</p>
  
  <pre><code>var list = (from pointFeature in communityMemberPointFeatureList
      join member in communityMemberList on pointFeature.CommunityMemberId equals member.Id
      group pointFeature by new { pointFeature.CommunityMemberId }
      into grouping
      select new
      {
          grouping,
          points = grouping.Sum(row =&gt; row.Point)
      }).ToList();
  </code></pre>
  
  <p>But this yielded a result like</p>
  
  <pre><code>[
    {
      points:7200,
      grouping:[
          {Id:1,Point:5000,FeatureId:1,CommunityMemberId:1},
          {Id:2,Point:2200,FeatureId:1,CommunityMemberId:1},
      ],
    }
    ...
  ]
  </code></pre>
  
  <p>What I really want is a result set like:</p>
  
  <pre><code>[
      {points:7200,CommunityMemberId:1,firstname:'john',lastname:'blah' ....},
      ...
  ]
  </code></pre>
  
  <p>Can someone tell me what I did wrong?</p>