WHAT TYPE OF JOIN SHOULD I USE?

Chintoo Semi

Total Post:135

Points:947
Posted by  Chintoo Semi
 1329  View(s)
Ratings:
Rate this:

Hi All!

My join knowledge is terrible, I can't find the correct one for this. I want to join the two tables on the TableA.userID and the TableB.otherID to match the

desired output. I don't have any foreign or primary keys set on the tables. What should I be using here?

TableA:

userID
field1 
field2 


TableB:

userID
otherID
myData1
myData2
myData3


Desired Output:

userID
otherID
myData1
myData2
myData3
field1
field2

Thanks in advance!

  1. AVADHESH PATEL

    Post:604

    Points:4228
    Re: What type of join should I use?

    Hi Chintto!

    As par your code, you can apply inner join as following

    select a.userID, b.otherID, b.myData1, b.myData2, b.myData3, a.field1, a.field1
    from TableA a
    inner join TableB b
    on a.userID = b.otherID

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!