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

General Discussion

Damian Sieczkowski
Damian Sieczkowski
9,730 Points

grouping-joining-and-cleaning-up challenge task 1

I can't seem to make task 1 of this challenge pass - http://teamtreehouse.com/library/grouping-joining-and-cleaning-up.

The question...

Group all reviews by "movie_id" and get the average "score" and alias it as "average".

My answer...

SELECT movie_id, AVG(score) AS average FROM reviews GROUP BY movie_id;

http://screencast.com/t/qA1TwOyqfYZ

Response

Bummer! There's something wrong with your query.

movie_id    average
2   0.30732E1
3   0.38333E1
4   0.27E1
5   0.36154E1
6   0.15E1
8   0.29167E1

http://screencast.com/t/l2bdZ5pYos

3 Answers

Hi there, here is the answer that worked for me:

SELECT AVG(score) AS average FROM reviews GROUP BY movie_id;
Damian Sieczkowski
Damian Sieczkowski
9,730 Points

Nice - thanks! I thought i needed to select the movie_id as well as the score for some reason.

Matt Keck
Matt Keck
1,231 Points

Thanks I was doing the same thing!