[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Can I join these two tables?

Posted on 2013-05-15
3
Medium Priority
?
318 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 Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
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.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

650 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