Limit join to one row

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 = lastest_comments.post_id

Thanks : )

Hi @tslocke
Only by creating a question, which returns the latest comments in a separate question. Or using Models.

1 Like