Have to link 3 tables together, all 3 have matching column modified date, however when I run the query on Microsoft SQL, it executes, the columns show up however there is no data in the joined tables… is there a problem with my syntax?
select sod.SalesOrderID, sod.ProductID, sod.UnitPrice, sod.LineTotal, sod.ModifiedDate, p.ProductCategoryID, sp.SalesYTD,
sp.SalesLastYear, sp.SalesQuota
from AdventureWorks2019.Sales.SalesOrderDetail sod
join AdventureWorks2019.Production.ProductCategory p on sod.ModifiedDate = p.ModifiedDate
join AdventureWorks2019.Sales.SalesPerson sp on sod.ModifiedDate = sp.ModifiedDate;
>Solution :
without knowing any more details, check which type of JOIN you actually want to use.
-JOIN: Returns records that have matching values in both tables
-LEFT OUTER JOIN: Returns all records from the left table, and the matched records from the right table
-RIGHT OUTER JOIN: Returns all records from the right table, and the matched records from the left table
More details at: https://www.w3schools.com/sql/sql_join.asp