title: Using two combined MySQL queries
body: <p>I have a query that I am using to join two tables (posts, relations) to return posts from users you are following (r.status= 1) or friends (r.status= 2) with. But then also omitting the posts where the post privacy is private (p.privacy= 2) and the current relationship (r.status= 1).</p>
  
  <p>Here is my query:</p>
  
  <pre><code>$user_id= 1;
  
  $posts_query= "
  SELECT DISTINCT post_id, user_id, story, photo, link, collection_id, privacy, date, type
  FROM posts p
  JOIN relations r ON p.user_id = r.recipient
  AND (r.sender = '".$user_id."')
  AND NOT (r.status = 1 AND p.privacy = 2)  
  ORDER BY p.post_id DESC;
  ";
  </code></pre>
  
  <p>Now the only problem with this query is that It omits your own personal posts.</p>
  
  <p>The query for that would be:</p>
  
  <pre><code>$your_posts_query= "SELECT * FROM posts WHERE user_id= '".$user_id."' ORDER BY p.post_id    
  DESC";
  </code></pre>
  
  <p>Now, This doesn't allow me aggregate all of the posts together. Yours, and the ones from your friends and the people you are following.</p>
  
  <p>How can I make it so that my first query also incorporates what my second query does?</p>