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 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 :)