Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


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

Posted on 2014-01-08
Medium Priority
Last Modified: 2014-01-08
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?

Question by:colinspurs
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
LVL 49

Accepted Solution

PortletPaul earned 2000 total points
ID: 39764718
It is quite acceptable to join like that.

Hard to give more advice without knowing more about the data & relationships; but is not "wrong"

Author Comment

ID: 39764785
Ok thanks.  I don't see that too often and suspect I have duplicate rows so wanted to verify it.

LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 39764790
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
LVL 13

Expert Comment

ID: 39764803
Yes, duplicates could be due to "cartesian product" or incorrect logic.
LVL 49

Expert Comment

ID: 39764979
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.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

604 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