Hi.
I have two tables with the following structure:
table name: friends
uid (PK)(FK)
friend_id (PK)(FK)
table name: posts
post_id (AI)(PK)
post_text
uid (FK) //poster id
I'd like to select posts that were only made from friends of user x
.
My inital plan was to use the following code:
SELECT posts.post_text INNER JOIN friends ON posts.uid = friends.friend_id
WHERE friends.uid = x
However, this doesn't seem to work. (I get all posts done by x, done all posts done by X's friends. The only alternative I can think of is to use a (possibly very long) string of OR's - as in
WHERE posts.uid = 'friend_id_1' OR posts.uid = 'friend_id_2' ect..
Any alternative solutions? Thanks.