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

Gary Law
Gary Law
14,632 Points

Cannot pass the Code Challenge task 2 of 3 of Stage 7: SQL Calculating, Aggregating and Other Functions -

Could anyone help to advise what is the problem for below code. thanks.

Stage 7: SQL Calculating, Aggregating and Other Functions

Challenge task 2 of 3 Like before, group reviews by "movie_id", get the average "score" as "average" and filter out any averages over 2. Type in your command below, then press Enter.

select avg(score) as average from reviews group by movie_id having average>2;

3 Answers

Hi Gary,

This one got me too, if you read the question again it says filter out any averages over 2, your statement is asking for values greater than 2. It should read less than < 2:

SELECT avg(score) as average FROM reviews GROUP BY movie_id HAVING average < 2;

Hope this helps. Bob

Gary Law
Gary Law
14,632 Points

Thanks so much for your help

Christopher Andrew Kemur
Christopher Andrew Kemur
7,709 Points

this post really help me, turn out i translated the question wrong. thank you guys.