Basically I have three tables and I want to select attributes from all 3.
SELECT Users.Name, Sales.SaleID, Return.ReturnAmount
FROM Users
INNER JOIN Sales ON Users.SaleID = Sales.SaleID
However, Return has a relationship with Sales, but not Users.
How would I include returnAmount?
JOINthe table. Simply addJOIN Return ON 1=1. However, if the table is not related, how would you determine exactly which values should be shown? In the worst case scenario, you end up with a Cartesian product returning all rows of theSalesandUserstable (that have a validJOIN, times the amount of rows in theReturntable.SalesIDthough:ON Users.SaleID = Sales.SaleIDSo, a sale has many users and every user is related to one sale? This doesn't look correct design.JOINheReturntable to the set using those criteria. AJOINdoesn't need to connect all tables (that'd be impossible), but rather you string together pieces of information that relate to part of the set.