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

It asks me to group reviews by movie_id and get the average score per movie.

Why is this not right:

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

2 Answers

You're almost there! The key is: you don't need to include everything in your results. You can group by a column without including it in the data you select.

You are right. I tested the "both tables have the column id" approach. This is the accepted answer. The task text is misleading.

Your query correct! What is problem??

Thank you for your reply. It is correct measured by the text of the task. But since there is that hidden thing of both tables having an id column it does not pass validation. I'm sure they will fix it.