Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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