title: SQL to LINQ query equivalent
body: <p>Hello I need to crate linq query from this SQL:</p>
  
  <p><strong>SQL:</strong></p>
  
  <pre><code>select 
     p.id, 
     p.Name, 
     sum(h.Hour) 
  from 
     dbo.Hour h 
  INNER JOIN dbo.ProjectView p ON h.ProjectId = p.Id 
  WHERE 
     h.PeopleId = 7999 
  group by 
     p.Name, p.Id
  </code></pre>
  
  <p><strong>LINQ:</strong> I tried this but it is not the same:</p>
  
  <pre><code>    var query = from hours in _hourRepository.GetAll()
                  join proj in _projectRepository.GetAll() on hours.ProjectId equals proj.Id
                  where hours.PeopleId == personId
                  group hours by new { proj.Id, proj.Name, proj.Flag, hours.Hours } into g
                  select new PopleProjectsSumDto
                  {
                      Id = g.Key.Id,
                      Name = g.Key.Name,
                      Flag = g.Key.Flag,
                      Hours = g.Sum(h =&gt; h.Hours)
                  };
  </code></pre>
  
  <p>OK i find <strong>solution</strong> by removing hours from group:</p>
  
  <p><strong>LINQ:</strong> </p>
  
  <pre><code>    var query = from hours in _hourRepository.GetAll()
                  join proj in _projectRepository.GetAll() on hours.ProjectId equals proj.Id
                  where hours.PeopleId == personId
                  group hours by new { proj.Id, proj.Name, proj.Flag } into g
                  select new PopleProjectsSumDto
                  {
                      Id = g.Key.Id,
                      Name = g.Key.Name,
                      Flag = g.Key.Flag,
                      Hours = g.Sum(h =&gt; h.Hours)
                  };
  </code></pre>