1

I'm trying to join two datatables of same keyfields.

table1

ID     Class    
----   -----
1       10  
2       9   

table2

ID     Class
----   -----
1       8   
2       7   

Result

ID      Class1    Class2
1        10       8
2        9        7
0

2 Answers 2

6

following is code for joining between user and userclients you can replace your table and get the result of join

Follwing image is for the c# but will give you idea in detail

enter image description here

Dim user = From u In Users Join uc In UserClients On u.Id = uc.UserId New From { _
    u.Id, _
    u.FirstName, _
    u.LastName, _
    uc.MobileNo, _
    uc.imeiNO, _
    uc.Id _
}

if you are beginner you can look this : SQL to LINQ ( Visual Representation )

Sign up to request clarification or add additional context in comments.

Comments

4

try something like this:

Dim test = From t1 in table1_
       Join t2 in table2 on t1.ID Equals t2.ID _
       Select  ID = t1.ID,
               Class1 = t1.Class,
               Class2 = t2.Class

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.