Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 260
  • Last Modified:

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
0
colinspurs
Asked:
colinspurs
1 Solution
 
PortletPaulCommented:
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
 
PortletPaulCommented:
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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now