Q 8 - Multiple Tables with Reddit

Multiple Tables with Reddit (https://www.codecademy.com/paths/analyze-data-with-sql/tracks/analyze-data-sql-join-data/modules/analyze-data-sql-practice-joins/projects/sql-multiple-tables-with-reddit)

Hello everyone,

I’m stuck with question 8…Could anyone have any advice for this?
This is what I have now.

WITH popular_posts AS (
  SELECT *
  FROM posts
  WHERE score >= 5000
  UNION
  SELECT *
  FROM posts2
  WHERE score >= 5000
)
SELECT subreddits.name, popular_posts.title, popular_posts.score
FROM subreddits
INNER JOIN popular_posts
  ON subreddits.id = posts.subreddit_id
ORDER BY popular_posts.score DESC;

Thank you for your help in advance!!

Hello! When you INNER JOIN on a table, you use the popular_posts table. So, what should you be using here:

Should it be posts or popular_posts?

3 Likes

Hi, I did the same, but in this section, I put this:

SELECT name, title, score
FROM subreddits
INNER JOIN popular_posts
ON subreddits.id = popular_posts.subreddit_id
ORDER BY popular_posts.score desc;

I’m Not sure if it’s ok, hope it helps someone!