Link to home
Start Free TrialLog in
Avatar of Eindoofus
Eindoofus

asked on

What happens when two "INNER JOIN" statements are used in one SQL query?

SELECT Products.ProductID, Products.ProductName, Products.SupplierID, Products.CategoryID, Products.QuantityPerUnit, Products.UnitPrice, Products.UnitsInStock, Products.UnitsOnOrder, Products.ReorderLevel, Categories.CategoryName, Suppliers.CompanyName FROM Products INNER JOINCategories ON Products.CategoryID = Categories.CategoryID INNER JOIN Suppliers ONProducts.SupplierID = Suppliers.SupplierID

Open in new window


Hi, I'm trying to understanding what is happening in the Northwind database query above. I understand the "SELECT" statement but everything from the "FROM" statement onwards is a bit confusing to me. I was hoping that someone could break it down for me.

Also, shouldn't the Suppliers.SupplierID and Categories.CategoeryID be in the SELECT statement? And Products has a "many to one" relationship with Suppliers and Categories, but what would happen with this statement if the relationship was "one to many"? Would I end up with duplicate Products?
ASKER CERTIFIED SOLUTION
Avatar of Chris Ashcraft
Chris Ashcraft
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Eindoofus
Eindoofus

ASKER

Great answer! Thank you :)