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
Chris Collins
2,490 PointsGrouping, Joining and Cleaning Up code challenge part 1 of 3
hey guys
heres the request
Group all reviews by "movie_id" and get the average "score" and alias it as "average".
heres my code
SELECT movie_id, AVG(score) AS average FROM reviews GROUP BY movie_id;
it works in MYSQL so id dont see whats wrong with it can someone help me out.
2 Answers
Andrew Shook
31,709 PointsThe problem only asks for the average score and not the movie_id. So you only need to select the score and get its average. Remove movie_id from the select portion of the query and it should look something like this : select AVG(score) as average from reviews group by movie_id; I just tried this query and it worked for me. Hope this helps.
Grant LeMahieu
11,301 Pointsgreat help Andrew Shook. Thanks.