Stuff
public text v1 · immutableSELECT
threads.title,
(SELECT COUNT(*) FROM replies WHERE thread_id = threads.id) AS num_replies,
(SELECT id FROM replies WHERE thread_id = threads.id ORDER BY posted_at DESC LIMIT 1) AS latest_reply_id,
(SELECT user_id FROM replies WHERE thread_id = threads.id ORDER BY posted_at DESC LIMIT 1) AS latest_reply_user_id
FROM threads
JOIN replies ON replies.thread_id = threads.id
ORDER BY threads.posted_at DESC LIMIT 100