I want to create a activity stream just like Google+ or Facebook.
My Problem is im really unsure whats the best way to query comments on multiple posts.
The easiest way is just selecting the comments in a loop, but this is really not the way i want to go.
Another possibility is joining them together.
SELECT c. *, p. *
FROM posts p
LEFT JOIN comments c ON p.post_id = c.post_id
WHERE something = something
Or selecting them separately.
SELECT * FROM posts WHERE something = something
SELECT * FROM comments WHERE post_id = 1 OR post_id = 2 OR post_id = 3
Is there a better way to do that?
I’m sorry for my bad english.
Regards
Try this:
Or, if you know the
post_ids: