I have two very large tables, both have over 10K recodes in them. I need to use Linq to query from these two tables. See below example, You can see I need to use group join.
Below is my query, it works. But it takes about 6-7 minutes to finish. TableA has over 10K records. TableB has more records than tableA.
from a in tableA
join b in tableB on new {ID = a.OrderID, Name = a.Option}
equals new{ID = b.OrderID, Name = b.SelectedOption} into jgroup
select new{
OrderID = a.OrderID,
SelectedOption = a.Option,
SelectedOptionValue =
jgroup.Select(g => g.SelectedOptionValue).SingleOrDefault()
}
Is there a better solution to make this faster using linq to SQL.
Any advice will be appreciated. Thanks!