Example. I need to get list of posts and match 1 comment to each one (newest, oldest or most rated).
Are there any suggestions?
SELECT *
FROM posts p
LEFT JOIN comments c
ON p.id = c.post_id
GROUP BY p.id
And now I need to set, which one from comments (top, newest or oldest) must be matched with post. But I really don't know how to.