Get top rated item using AVG mysql
- by user1876234
I want to find top rated item using AVG function in mysql, right now my query looks like this:
SELECT a.title, AVG(d.rating) as rating FROM in8ku_content a
JOIN in8ku_content_ratings d ON a.id = d.article_id
ORDER BY rating DESC
Problem is that it takes AVG of all items and the result is not accurate, what should be changed here to get correct result ?
Tables:
in8ku_content [id, title] in8ku_content_ratings [id, article_id, rating]