I want to show all the posts from the people I am following including my own posts too. While it is working as intended, I have a problem: I get the same posts multiple times.
Here is my query:
SELECT posts.id, posts.body, posts.posted_at, posts.postimg, posts.likes, users.`username`
FROM users, posts, followers
WHERE (posts.user_id = followers.user_id OR posts.user_id = :userid)
AND users.id = posts.user_id
AND follower_id = :userid
ORDER BY posts.posted_at DESC;
Can anyone help me? Thank you in advance.