Reputation: 322
i have 2 tables in a database named "posts", "connections"
with strucure as given in images
i have a variable that holds a value ,lets assume variable "a" ,it has to be checked against the field "following" in the connections table ,and the resulting rows should be used to select only those rows from the table "POSTS" where follower field is equal to the post_by field ,am really stuck on this one,could use a little help
Upvotes: 1
Views: 41
Reputation: 6344
Try this query :
SELECT * FROM posts AS P
INNER JOIN connections AS C ON C.follower = P.post_by
WHERE C.following = "a"
Upvotes: 2