this will help What is the reason for the 'GroupBy'? It seems to me that all you need to do is select the top 5 rows from db.Stats ordering by Hits descending. Like this:

code :

```
var results = (
from s in db.Stats
join p in db.Players on s.PlayerID equals p.ID
where s.SeasonID == lastSeasonId
order by s.Hits descending
select new { Player = p, Stats = s })
.Take(5).ToList();
```

```
var hitLeaders = (from s in stats
join p in players on s.PlayerID equals p.ID
group s by new { s.PlayerID, s.SeasonID } into g
select new
{
PlayerID = g.Key.PlayerID,
SeasonID = g.Key.SeasonID,
Hits = g.Sum(sum => sum.Hits),
AtBats = g.Sum(sum => sum.AtBats),
Walks = g.Sum(sum => sum.Walks),
Singles = g.Sum(sum => sum.Singles),
Doubles = g.Sum(sum => sum.Doubles),
Triples = g.Sum(sum => sum.Triples),
HomeRuns = g.Sum(sum => sum.HomeRuns),
RBIs = g.Sum(sum => sum.RBIs),
Runs = g.Sum(sum => sum.Runs),
ReachedOnErrors = g.Sum(sum => sum.ReachedOnErrors),
SacrificeFlies = g.Sum(sum => sum.SacrificeFlies)
}).OrderByDescending(s => s.Hits).Take(5);
```

```
public class TotalStat
{
public int TotalStatID { get; set; }
public int SeasonID { get; set; }
public int PlayerID { get; set; }
public int AtBats { get; set; }
public int Hits { get; set; }
public int Walks { get; set; }
public int Singles { get; set; }
public int Doubles { get; set; }
public int Triples { get; set; }
public int HomeRuns { get; set; }
public int RBIs { get; set; }
public int Runs { get; set; }
public int ReachedOnErrors { get; set; }
public int SacrificeFlies { get; set; }
}
```

```
public List<TotalStat> SeasonLeadersHits { get; set; }
```

```
//...
group s by new { s.PlayerID, s.SeasonID } into g
select new TotalStat
{
PlayerID = g.Key.PlayerID,
//...
```