?
Solved

Can I join these two tables?

Posted on 2013-05-15
3
Medium Priority
?
314 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
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.
Suggested Courses

770 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