WITH FiveRatedseries AS
(
SELECT
c.series_id,
series_name,
COUNT(DISTINCT r.profile_id) AS TotalProfileCount,
AVG(rating) AS AvgRating
FROM content c
INNER JOIN series s ON s.series_id=c.series_id
INNER JOIN reviews_ntf r ON r.content_id=c.content_id
GROUP BY c.series_id,
series_name
)
SELECT series_name,TotalProfileCount,ROUND(AvgRating,2)AS AvgRating
FROM FiveRatedseries
WHERE TotalProfileCount >= 5
ORDER BY AvgRating DESC
LIMIT 3
No comments:
Post a Comment