Monday, February 9, 2009

SQL join statement using 3 tables

SELECT DISTINCT mi.name, price
FROM ingredients i, vendors v, items mi, madewith mw
WHERE i.vendorid = v.vendorid
AND i.ingredientid = mw.ingredientid
AND mw.itemid = mi.itemid
AND companyname = 'Veggies_R_Us' ;