Mark
CreativeMountainGames.com
I thought I would cull this string of posts from the early thread as it has gotten lost in the shuffle, I think.
Anyway, there it is...
Mark said:Not sure if this has been addressed but it appears that products that haven't been reviewed are treated as having no stars and thus bring down the rating of a publisher.
Michael Morris said:Rats.. Hmm.. Well... I uh.. As soon as I figure out a correction to the query I'll recalculate it.
jmucchiello said:Shouldn't you just average the existing reviews without regard for how many products there are?
Select Sum(stars) as total_starts, Count(*) as total_reviews, publisher_id from reviews; (or join the reviews and pubs table if the pub_id is not available on the review table)
if (count > 0) stars = total_stars/total_reviews else stars = 0;
The number of products shouldn't enter into it.
Michael Morris said:The correct query, I believe, will be
SELECT AVG(score) AS score FROM product WHERE publisherid = $publisherid AND score > 0
Haven't had time to test it yet - been taking a break.
jmucchiello said:But that averages the product scores which are already an average. So if a publisher have two products: one with 100 reviews and an average of 3 and one with 1 review of 5, the publisher will have a score of 4 by that querry. That's why my querry was off of the (assumed) review table instead of the product table.
Anyway, there it is...