Answer the question
In order to leave comments, you need to log in
How to get record with max id?
table posts
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
Answer the question
In order to leave comments, you need to log in
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)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question