Is it possible to limit a join to a single row without going for a full SQL query?
e.g. select blog posts joined with most recent comment.
something like
select * from posts join (
select distinct on (post_id) * from comments order by post_id, created_at desc
) as latest_comments
on posts.id = lastest_comments.post_id
Thanks : )