I have a sql table called predictions with data as below
Week Player Points
201101 Mark 7
201101 Mark 7
201101 Pete 7
201101 Pet
mine is quite long
var weeklyTopScore = from eachMatch in FootballPredictions
group eachMatch by eachMatch.week
into weekly
select new {week = weekly.Key, topScore = weekly.Max(match => match.points)};
var playerWins = from eachResult in weeklyTopScore
join entry in FootballPredictions
on eachResult.week equals entry.week
where eachResult.topScore == entry.points
group entry by entry.player
into winner
select new { player = winner.Key, wins = winner.Count() };
var result = from entry in playerWins
group entry by entry.wins
into summary
select new { player = summary.Select(data => data.player).Aggregate((cur, nex) => cur + ", " + nex), wins = summary.Key};