title: Using both exists and simple value checking in MySQL query
body: <p>I have the following MySQL query:</p>
  
  <pre><code>SELECT * FROM posts p WHERE
      EXISTS (
          SELECT 1 FROM following f WHERE f.from = 2 AND f.to = p.uid
      )
      OR p.uid = 2
  </code></pre>
  
  <p>I want it to return all records from <code>posts</code> where <code>following</code> has a record <code>WHERE f.from = 2 AND f.to = p.uid</code> as well as all records where <code>p.uid = 2</code>.</p>
  
  <p>If I have the exists check first, only the records that match the exists return. If I swap them around only the records that match <code>p.uid = 2</code> return.</p>