I'm tying to improve my sql. I have 3 tabels called users, posts and blocked. If one user block another user it will add to blocked table from(blocker id) to(blocked id). Then it doesn't show this users posts to each other. I made it with 2 steps. Firsts looks to blocked users table with Select * from 'blocked' where from = :my_id OR to = :my_id. I save all ids in array. Then if i will take posts, i'm using Select * from posts where poster_id NOT IN (array). This method works. But i think it will slover if i block more than 1000 people. Any idea how can i do with one sql?
Asked
Active
Viewed 11 times
0
user3722203
- 21
- 6
-
start learning about joins – Aug 21 '16 at 21:07
-
@Dagon Thanks but i now about joins. but problem is that, i get everytime wrong posts or nothing – user3722203 Aug 21 '16 at 21:10
-
post your join, and the db schema – Aug 21 '16 at 21:11