I have a rather complicated LINQ query that joins several tables and selects a new anonymous type, which is three IEnumerable {Users, JobProviders, Jobs}. It returns IQueryable to support deferred execution, which removes DistintBy from this issue .
One of the columns is the rank, and I need to make sure that only the record with the lowest rank for each task is selected (another column, many tasks will be selected). The difference does not work, because the rank will obviously make the string unique.
I thought a group suggestion might help with this, but it changes the return type to IGrouping. I don’t quite understand how the group works, so I could be wrong, but it doesn’t seem to work. Is there a way to say for each job, take only the lowest rank?
sort of
let jobRank = JobProvider.Rank
...where min(rank)
source
share