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

Marvin Abella
Marvin Abella
6,378 Points

Group, Joining and cleaning up Challenge 2 of 3

Here is the challenge:

Like before, group reviews by "movie_id", get the average "score" as "average" and filter out any averages over 2.

And here's my solution:

SELECT AVG(score) AS average FROM reviews GROUP BY movie_id HAVING average > 2;

I believe I did it right but I'm still getting an error. Am I missing something here? help

10 Answers

Marvin Abella
Marvin Abella
6,378 Points

errrhh..Fixed it, got confused by the 'filter out', it meant print out the average UNDER 2.

SELECT AVG(score) AS average FROM reviews GROUP BY movie_id HAVING average < 2;
Mohsin Anwaar
Mohsin Anwaar
10,696 Points

2 months later and I made the same mistake :p

thanks for the answer

Took me a while to realize I was making this simple mistake. For anyone stuck, pay attention to your sign at the end.

Derrick Ray
Derrick Ray
19,083 Points

So glad I'm not alone!

Spent 15 minutes to figure this out!

I made the same mistake 1 year later

Almost a YEAR later and I made the same mistake as most people here! haha