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 trial

Development Tools

Andrew Chappell
Andrew Chappell
12,782 Points

SQL — 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

You'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.

I'm stuck on this as well any luck Andrew Chappell ?

Hashsham Maneri
Hashsham Maneri
6,983 Points

SELECT 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