Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Trying to join these 3 tables but nothing shows up

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 :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading