Retrieving multipel rows in MS SQL but distinct filteringen only on one
- by Nicklas
I have this:
SELECT Product.ProductID, Product.Name, Product.GroupID, Product.GradeID, AVG(tblReview.Grade) AS Grade
FROM Product left Join tblReview ON Product.GroupID = tblReview.GroupID
WHERE (Product.CategoryID = @CategoryID)
GROUP BY Product.ProductID, Product.Name, Product.GroupID, Product.GradeID
I would like to return only the rows where Product.Name is unique. If I make a SELECT DISTINCT the ProductID is diffrent on every row so all the rows are unique.
Thanks in andvance