------------------------------------------------------------------------
-- John David Ayers ----------------------------------------------------
-- October 15, 2009 ----------------------------------------------------
-- JOIN COMMAND --------------------------------------------------------
------------------------------------------------------------------------

-- Join
SELECT ProductNumber, WholesalePrice, DaysToDeliver, VendName
FROM Product_Vendors INNER JOIN Vendors ON Product_Vendors.VendorID = Vendors.VendorID;

SELECT  CategoryDescription AS [Category Description],
ProductNumber AS [Product Number],
ProductName AS [Product Name]
FROM Categories INNER JOIN Products ON Categories.CategoryID = Products.CategoryID;

-- Alias
SELECT  CategoryDescription AS [Category Description],
ProductNumber AS [Product Number],
ProductName AS [Product Name]
FROM Categories AS c INNER JOIN Products AS p ON c.CategoryID = p.CategoryID;

-- Joining +2 Tables
SELECT  VendName, ProductName, RetailPrice
FROM (Vendors AS v INNER JOIN Product_Vendors as pv ON v.VendorID = pv.VendorID)
INNER JOIN Products as p ON pv.ProductNumber = p.ProductNumber;
