Retrieving multipel rows in MS SQL but distinct filteringen only on one

Posted by Nicklas on Stack Overflow See other posts from Stack Overflow or by Nicklas
Published on 2010-05-11T14:55:03Z Indexed on 2010/05/11 15:04 UTC
Read the original article Hit count: 301

Filed under:
|

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

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about sql