Avatar of VBdotnet2005
VBdotnet2005
Flag for United States of America asked on

join in LINQ to SQL

How do we join two tables in LINQ to SQ?

table_A     table_b

id              id
acct          acct
address    job_position
ASP.NET

Avatar of undefined
Last Comment
aibusinesssolutions

8/22/2022 - Mon
aibusinesssolutions

In VB.NET it would be like this.

Dim q = From a In db.table_A _
            Group Join b In db.table_B On a.id Equals b.id Into employees = Group _
            Select New With {a.address, b.job_position}
VBdotnet2005

ASKER
Group join kind of like innerjoin?
VBdotnet2005

ASKER
What is Into employees = Group ?
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
ASKER CERTIFIED SOLUTION
aibusinesssolutions

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
aibusinesssolutions

employees is a temporary object to hold the join, I just named it employees, it can be anything.  

Group Select New With {a.address, b.job_position} creates the group that you can enumerate through
aibusinesssolutions

If you want more examples of advanced joins or other LINQ to SQL samples, check this page out.

http://msdn.microsoft.com/en-us/vbasic/bb688085.aspx