id link user_id
22 www 44
23 ddd 44
33 ddd 55
id user_id, some_id
2 44 66
3 55 66
SELECT posts.id, posts.link, posts.user_id FROM posts WHERE posts.user_id IN (SELECT comments.user_id FROM comments WHERE some.id=66) GROUP BY posts.user_id
SELECT posts.id, posts.link, posts.user_id FROM posts WHERE posts.user_id IN (SELECT comments.user_id FROM comments WHERE some.id=66) WHERE MAX(post.id)