title: MYSQL JOIN on multiple tables returning no results
body: <p>Well let's see, the query I have is working fine, as soon as a friendpost is done, however. If the user has no friends, no result will be returned, and that's what I am trying to get a hang of...</p>
  
  <pre><code>    $query = "SELECT DISTINCT m.id, p.byuser, p.`newpost`, p.`id`, p.`postdate`
      FROM users m
      JOIN pinnwand p 
        ON m.id = p.byuser
      JOIN friends f 
        ON f.`userid` = m.id OR f.`friendid` = m.id
      WHERE (f.`userid` = $myId OR f.`friendid`= $myId)
        AND (p.`touser` = p.`byuser` OR p.`touser` = $myId)
        AND p.`publicp` &lt; 3 
        AND p.`typ` = 2
      ORDER BY p.id DESC LIMIT $limit, 10";
  </code></pre>
  
  <p>I hope somebody can help me, maybe I am just blind for nao... </p>
  
  <hr>
  
  <p><strong>Edit</strong>
  As Steven helped me out quite a lot, maybe somebody finds the last bit missing: It's just showing the posts made for the specific user. Even though as I understand the query it should get the posts made by friends on their pinboard as well? After all the <code>m</code>.<code>id</code> should get the friendtables value as well, or am I wrong?</p>
  
  <hr>
  
  <p><strong>Edit 2</strong>
  So as I went with the UNION and Subquery Method for now, I still want to describe what the result should look like:</p>
  
  <p>Show: Userposts made whereever, Posts by whomever made on the Userboard, Friendposts made on their own board! Not the posts made by people on friends boards.</p>