select AVG(tbl_entry.rating) as rating
from tbl_category
join tbl_subcategory on tbl_category.id=tbl_subcategory.category_id
join tbl_entry on tbl_subcategory.id=tbl_entry.subcategory_id
where tbl_category.id=:id and tbl_entry.author_id=:author_id
catgory.id comes from the current model object. author_id should come as parameter.
The use case is the following:
I want to print the average rating for each category for every author: