I am doing a webpage of a food review, there is a page called top 10 where it will display the top 10 according to food review. I currently have this SQL but it combines all the dishes ratings and combine as a 1 dish. This SQL statement is being placed in PHP code.
SELECT i.path, i.name, AVG(r.review_rating), r.image_id
FROM images i, review r
WHERE r.image_id = i.id
GROUP BY 'r.image_id'
ORDER BY AVG(r.review_rating) DESC
LIMIT 10