I have a table of flight price data and I want to return the top 1 cheapest flight to each destination destination. The table has the following basic fields:
FlightInfoID
AirportFrom
AirportTo
Price
I tried the following but it did not return the results I expected as there were multiple items for a specific destination and I only want 1 result per destination so if I have 50 destinations I would get 50 items returned.
lstBestFlightDealsForAllRoutes.OrderBy(p=> p.Price).GroupBy(x => x.AirportTo).First();