I have a vendors table and a vendor ratings table. I am trying to create a view that shows ALL vendors on left and their overall rating on the right. I would like the vendors to show up even if they have not been rated yet. I'm using mysql 5.7. This is my query:
SELECT
vendors.ID,
vendors.Vendor,
ROUND(((AVG(`Cost_Rating`) + AVG(`Documentation_Rating`) + AVG(`Safety_Rating`) + AVG(`Equipment_Rating`) + AVG(`Performance_Rating`) + AVG(`Promptness_Rating`) + AVG(`Communication_Rating`))/7.0),2) as `Overall Rating`,
vendors.`Phone #`,
vendors.`Fax #`,
vendors.Website,
vendors.`Physical Address`,
vendors.`P.O. Box`,
vendors.City,
vendors.`State`,
vendors.Zip,
vendors.`Region Serving`,
vendors.Note,
vendors.OnVendorList,
vendors.`Search Words`,
ROUND(AVG(`Communication_Rating`),2) AS `Average Communication Rating`,
ROUND(AVG(`Promptness_Rating`),2) AS `Average Promptness Rating`,
ROUND(AVG(`Performance_Rating`),2) AS `Average Performance Rating`,
ROUND(AVG(`Equipment_Rating`),2) AS `Average Equipment Rating`,
ROUND(AVG(`Safety_Rating`),2) AS `Average Safety Rating`,
ROUND(AVG(`Documentation_Rating`),2) AS `Average Documentation Rating`,
ROUND(AVG(`Cost_Rating`),2) AS `Average Cost Rating`
FROM vendors
LEFT JOIN `Vendor Ratings` ON vendors.vendor = `vendor ratings`.vendor
No matter what type of join I use I get the same results. Where is my problem?