Hello!
I have two tables; one containing product names and one with reviews of the products. What I'd like to do is present a table with the product names and number of reviews. The thing is that there can be more than one entry of a certain product in the products table. When I write something like:
SELECT products.name, COUNT(reviews.r eview)
FROM products
JOIN reviews ON products.name = reviews.product name
GROUP BY products.name
I will get a table like:
ProductA 3
ProductA 3
ProductB 1
ProductC 0
In this case ProductA appears twice in the products table and has 3 reviews in the reviews table. But I just want it to appear once in the joined table, how to do? Any tip highly appreciated.
/Chris
I have two tables; one containing product names and one with reviews of the products. What I'd like to do is present a table with the product names and number of reviews. The thing is that there can be more than one entry of a certain product in the products table. When I write something like:
SELECT products.name, COUNT(reviews.r eview)
FROM products
JOIN reviews ON products.name = reviews.product name
GROUP BY products.name
I will get a table like:
ProductA 3
ProductA 3
ProductB 1
ProductC 0
In this case ProductA appears twice in the products table and has 3 reviews in the reviews table. But I just want it to appear once in the joined table, how to do? Any tip highly appreciated.
/Chris
Comment