Does somebody have a suggestion how to compose the following query with the Querybuilder?
The essence of the query; A Campsite can have multiple reviews, every review has a various number of numeric scores. The purpose of the query is to calculate the avg of every review and then calculate the avg of all reviews.
SELECT AVG(reviews.sclr0) FROM (
SELECT AVG(a0_.score) AS sclr0
FROM AcsiCampsiteReview_Score a0_
INNER JOIN AcsiCampsiteReview_Review a1_ ON a0_.reviewID = a1_.reviewID
WHERE a1_.status = 2
AND a1_.relationID = 'campsite-2014-100011'
GROUP BY a1_.reviewID
) reviews
Thanks for your help!