Accepted answer

You could try something like this:

data.GroupBy(d => new { Hometeam = d.Hometeam, Outteam = d.Outteam })
    .Select(g => g.OrderBy(d => d.Status)
                  .ThenByDescending(d => d.GoalsHometeams + d.GoalsOutteams)
  1. Groups by the team combinations
  2. For each group, finds the entry with the newest status (Confirmed comes before Open in alphabetical order)
  3. If multiple with same status (i.e., multiple Open), finds entry with highest combined score.
  4. Grabs the first result (which should be newest) per group.


Sample Result:

Current game status results:
Confirmed, Fylkir, Valur, 3, 1
Confirmed, Selfoss, Grindavik, 3, 3
Confirmed, Keflavik, IBV, 1, 0
Confirmed, Stjarnan, IA, 1, 1
Confirmed, Breioablik, Fram, 0, 2

Related Query

More Query from same tag