I have two sets of data: trainedOfficers
and officersToTrain
. These data sets share a ClubId
in common. I'm trying to make sure that trainedOfficers
don't appear in officersToTrain
so I want to perform right outer join. Looking at this image:
- A = trainedOfficers
- B = officersToTrain
I have tried doing the following query but it yields no results.
public void SetTrainedClubOfficers(ILookup<ClubID, ClubOfficerAuthority> clubsAuthorityLookup)
{
var clubIds = clubsAuthorityLookup.Select(x => x.Key);
var trainedOfficers = GetTrainedClubOfficers(clubIds.ToArray());
var clubsToTrain = from trainedOfficer in trainedOfficers
join officer in clubsAuthorityLookup
on trainedOfficer.Key equals officer.Key into joined
from officer in joined.DefaultIfEmpty()
select new
{
ClubId = officer.Key,
Officers = officer.Select(club => club)
};
}
How can I get the right outer join?