How can I select * from table posts
but using table network_follow.follower
as where condition?
I have table posts
, column by_user
and table network_follow
column follower
I don’t know if that’s the case, can somebody help?
select * from posts where posts.by_user = network_follow.follower = user_logged
Advertisement
Answer
Join the tables and then filter the network_follow
table with the WHERE
condition.
SELECT p.* FROM posts AS p JOIN network_follow AS n ON p.by_user = n.followed WHERE n.follower = user_logged