how to make sql inner join in two datatables?

Posted on 2008-11-17
Last Modified: 2013-12-17
I have one dataset that contains two DataTables:








the other DataTable2 returns




If I would have treated this as regular queries and join them on Customer_ID
the resulting set would only contain:




Is there a way to inner join the two DataTables to create a third DataTable
with the desired results. I have tried to user Relations.Add method with no

Question by:Ameerh24
    LVL 53

    Accepted Solution

    LVL 4

    Assisted Solution

    I'm not sure what you're aims are, but I think you want everything from Table1 plus the information from Table2. Inner Joins pull only the common data between the two tables so I'm guessing you need an outer join.

    If you want all of the rows in Table1 appended with all the rows in Table2 you'll need a left outer join, this will show all rows from Table1 but will also add the information from Table2 if there is anything there (otherwise it will be null).
    Right outer join does the opposite, all from Table2 appended with data from Table1 and finally, should you need it, a full outer join gets all the information from both tables regardless if there is a common link between the two.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now