Mycontext mycontext = new Mycontext(); var list1 = mycontext.ExampleAs.ToList(); var list2 = mycontext.ExampleBs.ToList(); var notcontainId=list1.Select(l1 => l1.CreatorId).Except(list2.Select(l2 => l2.Id)).ToList(); List results = new List(); var result1 = (from a in mycontext.ExampleAs from b in mycontext.ExampleBs where a.CreatorId == b.Id select new Result { Id = a.Id, Name = b.Name }).ToList(); var result2 = (from a in notcontainId from b in mycontext.ExampleAs where a == b.CreatorId select new Result { Id = a, Name = null }).ToList(); results.AddRange(result1); results.AddRange(result2); Console.WriteLine(); public class Result { public int Id { get; set; } public string? Name { get; set; } }