title: Can I make a statement with two WHEREs and value of second where coming from 3rd table?
body: <p>I have 3 tables. First one is users, with different users on it. Second one has posts on it, with posters ID from table1 and the contents of the post. </p>
  
  <p>Third table has the friendslist. In the form of:</p>
  
  <pre><code>+------------+----------+
  | userID | friendID |
  +------------+----------+
  |          4 |        3 |
  |          3 |        4 |
  |          1 |        3 |
  |          3 |        1 |
  +------------+----------+
  </code></pre>
  
  <p>Now what I am trying to figure out is how to make it so that when user1 looks at the posts he only sees the posts of only his friends.</p>
  
  <p>I got as far as creating this: </p>
  
  <p><code>SELECT posts.IDpost, users.name, posts.created, posts.content FROM users JOIN posts ON users.id=posts.poster WHERE posts.poster= ?</code></p>
  
  <p>I figured I would have to add something like this:</p>
  
  <pre><code>WHERE friendslist.user= user1;
  </code></pre>
  
  <p>But I can't figure out how to add it, tried google searching for it with no luck, I don't know if I simply can't figure out how to search for it or it is not possible. I probably have to use a JOIN at the end there, but again, I'm not sure how.
  So how could I join values from 3 tables, with 2 WHERE commands?
  Hope someone understands my question and is able to help.</p>