Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAndrew Chappell
12,782 PointsSQL — Challenge 3 of 3 Grouping, Joining and Cleaning up
I'm doing challenge 3 of 3 but I'm completely stuck. This is what I have so far but I can't pass the challenge.
SELECT AVG(score), IFNULL(AVG(score), 0) AS average FROM reviews RIGHT OUTER JOIN movies ON movies.id = reviews.movie_id GROUP BY movie_id HAVING IFNULL(AVG(score), 0) <= 2
3 Answers
Ben Rubin
Courses Plus Student 14,658 PointsYou're almost there. I think you just accidentally selected the average score twice instead of selecting the title. Replace AVG(score)
with title
and it should work.
Andrew Cottage
20,718 PointsI'm stuck on this as well any luck Andrew Chappell ?
Hashsham Maneri
6,983 PointsSELECT movies.title, IFNULL(AVG(score),0) AS average FROM reviews LEFT OUTER JOIN movies ON reviews.movie_id=movies.id GROUP BY movie_id HAVING AVG(score)<2;
any ideas why this isn't working? Also Andrew, I believe Ben is correct. Also, the second IFNULL seems redundant