I have a flight pricing data table, and I want to return the 1 cheapest flight for each destination. The table has the following main fields:
FlightInfoID
AirportFrom
AirportTo
Price
I tried the following, but did not respond to the expected results, since there were several elements for a particular place, and I only need 1 result for each destination, so if I have 50 destinations, I get 50 returned elements.
lstBestFlightDealsForAllRoutes.OrderBy(p=> p.Price).GroupBy(x => x.AirportTo).First();
source
share