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 Database Foundations SQL Calculating, Aggregating and Other Functions Grouping, Joining and Cleaning Up

Gareth Redfern
Gareth Redfern
36,217 Points

PHP / Database Help On Task 3

Can anyone help with the following task, as I am sure my answer is correct but I must be misunderstanding the question. Here is my answer:

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

3 Answers

You just need to remove movie_id from the list of fields that you're selecting. Your query is correct, but I guess Treehouse's validation engine gives an error if you do extra things beyond what the question asks for.

Paul Yabsley
Paul Yabsley
46,713 Points

It is a valid query but the question doesn't ask for the movie_id to be selected, only to group by it. Try removing movie_id from the select clause.

Gareth Redfern
Gareth Redfern
36,217 Points

Ahh yes that did it thank you :)