Solved

VB.net Join/merge 3 datatables by joining first two columns

Posted on 2014-02-18
3
2,576 Views
Last Modified: 2014-02-19
Hi

What VB.net code would I use to join 3 datatables by doing an inner join on the first two
columns/fields? The first two fields are of course the same.
0
Comment
Question by:murbro
3 Comments
 
LVL 11

Expert Comment

by:SAMIR BHOGAYTA
ID: 39869743
hi...
Try this examples

SELECT a.sales_id, d.bus_title, s.cat_id
FROM tbl_sales a
INNER JOIN tb_sales_category s ON a.sales_id = s.sales_id
INNER JOIN tbl_business      d ON a.bus_id   = d.bus_id
INNER JOIN tb_category       b ON s.cat_id   = b.cat_id

or

SELECT p.Name, v.Name
FROM Production.Product p
JOIN Purchasing.ProductVendor pv
ON p.ProductID = pv.ProductID
JOIN Purchasing.Vendor v
ON pv.VendorID = v.VendorID
WHERE ProductSubcategoryID = 15
ORDER BY v.Name
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 39870176
You would need to add these datatables into a dataset and then add DataRelations for these tables. Example below

http://www.codeproject.com/Articles/18304/Using-Data-Relation-with-Data-Table
0
 

Author Closing Comment

by:murbro
ID: 39870292
Thanks very much
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

760 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

21 Experts available now in Live!

Get 1:1 Help Now