Ok, I have a e-commerce store that uses stored procedures to sort products. I have figured out how to sort my name and price but am having trouble sorting by rating bc the rating table doesnt have all the productids (only ones that have a rating) and also the rating table is in a different table than the products table so when I use the code below it only shows products that have a rating. Heres an example http://www.tunerplaza.com/c-304-carburetion.aspx?
Heres the sql code For the rating....
ELSE IF @sortEntityName = 5 BEGIN --Sort By Rating
INSERT #RowNumber (rating)
SELECT RT.Productid
FROM Rating RT
GROUP BY RT.ProductID
ORDER BY MIN(RT.Rating)
INSERT #displayorder select rating, displayorder from #RowNumber
END