Reputation: 91
having problems with the following inner joins query on my products table -->>
SELECT products.prod_id, products.prod_name, products.price, suppliers.company_name, customers.phone,
FROM products
INNER JOIN suppliers
ON suppliers.supp_id = suppliers.supp_ID;
Upvotes: 0
Views: 356
Reputation: 1258
You are joining on suppliers.supp_id = suppliers.supp_ID;
Both from the suppliers table... you want an attribute from the product table. Something like:
products.supp_id = suppliers.supp_ID;
Which will result in the following query:
SELECT
products.prod_id,
products.prod_name,
products.price,
suppliers.company_name,
customers.phone
FROM
products
INNER JOIN
suppliers
ON
products.supp_id = suppliers.supp_ID;
Upvotes: 1