Hacker News new | ask | show | jobs
by alex_lav 990 days ago
Sorry, I feel like there must be something I'm not understanding about the limitation you're trying to convey.

WITH relevant_users AS (

  SELECT id FROM users WHERE id IN (1)
)

SELECT users.name, mra.title

FROM users

INNER JOIN most_recent_articles mra

ON users.id = mra.user_id

INNER JOIN relevant_users

ON users.id = relevant_users.id;

This is a single query that can fetch users filtered by the First: (although I just did in, you could add whatever filtering options you wanted in the relevant_users cte) with the most recent articles view we've discussed previously.