---
title: "What type of join should I use?"  
description: "What type of join should I use?"  
author: "Anonymous User"  
published: 2013-03-11  
updated: 2013-03-11  
canonical: https://www.mindstick.com/forum/646/what-type-of-join-should-i-use  
category: "mssql server"  
tags: ["mssql server"]  
reading_time: 1 minute  

---

# What type of join should I use?

Hi All!

My join [knowledge](https://www.mindstick.com/forum/156160/what-is-google-knowledge-graph) is terrible, I can't find the correct one for this. I want to join the [two tables](https://www.mindstick.com/forum/159646/how-to-join-two-tables-in-oracle-to-get-single-line-results) on the TableA.userID and the TableB.otherID to [match](https://www.mindstick.com/forum/159713/regex-match-attribute-in-an-html-code) the

desired [output](https://www.mindstick.com/interview/34427/explain-the-output-in-angular). I don't have any [foreign](https://yourviews.mindstick.com/story/2164/here-are-the-best-foreign-universities-for-higher-education) or [primary keys](https://www.mindstick.com/forum/156008/how-do-you-set-two-primary-keys-in-access) 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](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)!

## Replies

### Reply by AVADHESH PATEL

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.field1from TableA ainner join TableB bon a.userID = b.otherID


---

Original Source: https://www.mindstick.com/forum/646/what-type-of-join-should-i-use

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
