You can do something like this:-
var output= countries.GroupBy(c => new { c.State, c.City })
.Select(a => new
{
City = a.Key.City,
State = a.Key.State,
Zip = a.Max(z => z.Zip)
}).OrderBy(m => m.City);
1
solved sql to linq conversion for this table [closed]