Solved

Can I join these two tables?

Posted on 2013-05-15
3
310 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 92

Accepted Solution

by:
Patrick Matthews earned 500 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

680 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