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

Databases

Jordan Petty
Jordan Petty
4,844 Points

Help with Reporting w/ SQL

From the 2nd Sum Task:

> SELECT SUM(rating) AS starman_total_ratings, movie_id FROM reviews 
GROUP BY movie_id 
ORDER BY starman_total_ratings DESC 
LIMIT 1; 
SELECT * FROM reviews WHERE movie_id = 6;

Also I am not sure how to show you code here the correct way. Can someone show me?

1 Answer

Steven Parker
Steven Parker
231,248 Points

Your blockquoting works OK, but the normal way to quote any kind of code is in the Markdown Cheatsheet pop-up below the answer area :arrow_heading_down:

You didn't provide a link to your challenge, and the only one I could find for summing values was this one, which has only one task.

It looks like you have two separate queries there. The first one is way over-complicated for this task, and the second one is a bit too simple. But if mix the beginning of the first one and the end of the second one you get one that's just right for this task:

SELECT SUM(rating) AS starman_total_ratings      FROM reviews WHERE movie_id = 6;