Alex Rivera | Logout

What is the syntax for an inner join in LINQ to SQL?

Asked 2008-09-01T01:00:24.467
490

I'm writing a LINQ to SQL statement, and I'm after the standard syntax for a normal inner join with an ON clause in C#.

How do you represent the following in LINQ to SQL:

select DealerContact.*
from Dealer 
inner join DealerContact on Dealer.DealerID = DealerContact.DealerID
Edit
Report

1 Answer

26

Use Linq Join operator:

var q =  from d in Dealer
         join dc in DealerConact on d.DealerID equals dc.DealerID
         select dc;
answered 2008-09-01T01:09:30.420

Your Answer