I've got MySQL 4.1 and some legacy software that allows users to rate the quality of an item in a poll, rated from lowest to highest (1-5).
I need to create a SQL query that on its own generates a top 10 list of highest rated items which returns as columns the ranking, pollID and average rating per poll (minumum 6 votes). I am seeking help on the average rating column.
The simplified structure of the table that stores the poll results:
I did a little research and I think what I need (or close) is a Bayesian estimate such as the commonly used formula documented here.
Problem is, I'm not sure what to plug in and where. Once I see that I can go from there (set sort order and limit, add additional select fields that exist in the real table, etc.) Needs to be a query as the software uses the query results to display the top 10 report. The real report is more detailed than this, of course.
Thank you!
-jim
I need to create a SQL query that on its own generates a top 10 list of highest rated items which returns as columns the ranking, pollID and average rating per poll (minumum 6 votes). I am seeking help on the average rating column.
The simplified structure of the table that stores the poll results:
Code:
PollID Rating Votes
----- ------ -----
1 5 100
1 4 80
1 3 20
1 2 18
1 1 2
...and so on...
Problem is, I'm not sure what to plug in and where. Once I see that I can go from there (set sort order and limit, add additional select fields that exist in the real table, etc.) Needs to be a query as the software uses the query results to display the top 10 report. The real report is more detailed than this, of course.
Thank you!
-jim