Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6904431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:03:37+00:00 2026-05-27T08:03:37+00:00

How to join a table to more than one table? something like this we

  • 0

How to join a table to more than one table? something like this we can easily do in SQL

SELECT p.* FROM Person.BusinessEntity AS e
INNER JOIN Person.Person AS p ON e.BusinessEntityID = p.BusinessEntityID
AND e.BusinessEntityID = p.BusinessEntityID  INNER JOIN Person.BusinessEntityContact AS b 
ON e.BusinessEntityID = b.BusinessEntityID AND p.BusinessEntityID = b.PersonID

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:03:37+00:00Added an answer on May 27, 2026 at 8:03 am

    Generally, you just stack the joins just like you’d do in SQL. I see that the original question has been clarified a bit, and a composite key join is likely necessary so it will be a combination of stacking joins with composite keys. Gary.S noted the correct syntax for the composite key part in his comments to the original question, but I’ve ammended my answer here to include the same composite key selection. For regular joins you use the

     join … in … on … equals … 
    

    And for composite keys you use anonymous types to contain all the key columns from both entities.

    Here is an example that should be about what you are looking for

    var items = from e in Person.BusinessEntity
            join p in Person.Person on 
                 e.BusinessEntityID equals p.BusinessEntityID
            join b in Person.BusinessEntityContact on 
                 new {e.BusinessEntityID, p.BusinessEntityID} equals 
                 new { b.BusinessEntityID, b.PersonID} 
            select p;
    

    You might also need to look at the GroupJoin, which you need in order to do a left outer join in LINQ.

    Group join looks like:

    join … in … on … equals … into …
    

    Good examples of most cases can be found at the 101 samples page

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If you add more than one table to the FROM clause (in a query),
I have a table with more than 100 columns. I need to join it
How do I do an inverse join with more than one key column? In
I have two tables that are something like this: Main table: id (int), title
This is more of a challenge question than something I urgently need, so don't
I'm trying to create a record within a join table from the action of
I'm trying to create a record within a join table from the action of
I've seen people writing the following query SELECT column_name(s) FROM table_name1 LEFT JOIN table_name2
I have an sql query pulling a few results from different tables, one of
I want to count the number of records in database from more than two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.