i’m wondering why this code:
WITH popular_post AS (
SELECT MAX(posts.score) AS ‘top_scorer’
GROUP BY posts.subreddit_id
ON subreddits.id = posts.subreddit_id;
do not return the same result of the code suggested by the hint:
subreddits.name AS ‘subreddit_name’,
MAX(posts.score) AS ‘highest_score’
INNER JOIN subreddits
ON posts.subreddit_id = subreddits.id
GROUP BY subreddits.id;
Could you either edit your answer or add a reply with your full query (part of it seems to have gone walkabouts
). Ideally please format your code too as per the guidance linked below-
In general, your post will get a good answer if you’ve remembered to do the following:
Always search for existing answers first.
Provide as much information and context as possible.
Format your code.
Reference Additional Resources
Before Starting a Topic, Search for Existing Answers
Before you start a new topic, check existing posts and use Google to see if your questions have already been addressed. This will very often give you an immediate answer! Crypti…
Struggling with this step, too. Are we supposed to save the results from the previous step? I’ve tried both and neither works.
The bottom have of your code is all you need. Remove everything before the third SELECT.
The question is asking to get the order the results by each popular post’s score in descending order. Using “Order by” instead of “group by”
I paste my code, hope this helps
WITH popular_posts AS (
WHERE score >= 5000
SELECT subreddits.name, popular_posts.title , popular_posts.score
INNER JOIN popular_posts
ON subreddits.id = popular_posts.subreddit_id
ORDER BY popular_posts.score DESC;