[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Can I join these two tables?

Posted on 2013-05-15
3
Medium Priority
?
320 Views
Last Modified: 2013-05-15
I want to join two tables. TableA to TableB.

TableA has a Primary Key but TableB has no foreign key.

They both have a column named Type1_ID.  And Type1_ID is not a primary or foreign key in either table.

Is there a best practice approach in this type of situation?
0
Comment
Question by:rhservan
3 Comments
 

Expert Comment

by:STHOMP02169
ID: 39168801
Joining on a primary or foreign key isn't required. You do want to make your join unique though. Can you provide a little more infromation on the nature of the two tables? Do both contain attributes of a specific fact? or does TableB define Type1_ID?
0
 

Author Comment

by:rhservan
ID: 39168830
Yes on the attributes.  

Type1_ID column in TableA & TableB are define the same.
0
 
LVL 93

Accepted Solution

by:
Patrick Matthews earned 2000 total points
ID: 39168837
To join tables, you need some way of specifying the relationship between the two.  That is, you have to have some way of identifying which row(s) on TableB correspond to a given row on TableA, and vice versa.

So, if the relationship is based on having the same values in the Type1_ID columns, then yes, joining on that is perfectly fine.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

834 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