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

PHP

Makayi Lendo
Makayi Lendo
9,033 Points

SQL calculating, aggregating...code challenge 3 of 3 stage 7

I am stuck on code challenge task 3 of 3. I cannot get it right , here's my code:

SELECT title, IFNULL(AVG(score),0) AS average FROM reviews LEFT OUTER JOIN movies ON reviews.movie_id = movies.id GROUP BY movie_id HAVING average > 2;

2 Answers

Makayi Lendo
Makayi Lendo
9,033 Points

I got it! The code stays the except that you have to a RIGHT OUTER JOIN instead of LEFT OUTER JOIN

I had a similar problem. try this less than two.

SELECT title, IFNULL(AVG(score),0) AS average FROM reviews LEFT OUTER JOIN movies ON reviews.movie_id = movies.id GROUP BY movie_id HAVING average < 2;

Travis Johnston
Travis Johnston
12,653 Points

Kept having trouble with this challenge. Your code is similar but mine only worked if I did a RIGHT OUTER JOIN