SQL joining to a table from two other tables in one go

Hi all,

I have inherited this query from a colleague.  I am not sure whether it is OK / recommended / downright wrong to join to a third table using fields from two other tables in the one join.

Can you advise please?

Thanks,
   Colin
Capture.PNG
LVL 3
colinspursAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
PaulConnect With a Mentor Commented:
It is quite acceptable to join like that.

Hard to give more advice without knowing more about the data & relationships; but is not "wrong"
0
 
colinspursAuthor Commented:
Ok thanks.  I don't see that too often and suspect I have duplicate rows so wanted to verify it.

Cheers
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
I concur that this is perfectly possible (I use i almost every day).

if you have "duplicate rows", you may want to read up this article for explanations and solutions:http://www.experts-exchange.com/Database/Miscellaneous/A_3203-DISTINCT-vs-GROUP-BY-and-why-does-it-not-work-for-my-query.html
0
 
sameer2010Commented:
Yes, duplicates could be due to "cartesian product" or incorrect logic.
0
 
PaulCommented:
Thanks for the points...

"duplicate rows" usually means "unexpected, and unwanted, repetition" that may not be due to that join. Most often it is many-to-one relationships that are the cause.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.