About
Pricing
Community
Teams
Start Free Trial
Log in
VBdotnet2005
asked on
3/3/2009
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
6
1
Last Comment
aibusinesssolutions
8/22/2022 - Mon
aibusinesssolutions
3/3/2009
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
3/3/2009
ASKER
Group join kind of like innerjoin?
VBdotnet2005
3/3/2009
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
3/3/2009
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
3/3/2009
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
3/3/2009
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
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}