title: MySQL - Inner join into same table with WHERE clause
body: <p>I have a MySQL table called <strong>campaigns</strong> like the following</p>
  
  <pre><code>ID    integer
  Name  text
  isBalanced  boolean
  redirects  tinyint
  </code></pre>
  
  <p>I am trying to achieve a SELECT query so that I get ALL the rows where <code>isBalanced</code> is false PLUS only a DEFINED number of rows where <code>isBalanced</code> is true. After I get this result I need to get the single one with the lowest number of <code>redirects</code>.</p>
  
  <p>I know that there are ways to do it but I am having an hard time to figure out how. This is what I got until know</p>
  
  <pre><code>SELECT campaigns.id, campaigns.name, campaigns.isBalanced, campaigns.redirects
  FROM campaigns AS c
  INNER JOIN campaigns_2 AS c2
  WHERE c.isBalanced = 0
  </code></pre>
  
  <p>However I am not able to select just some of them from the c2 set and then regroup all the filter to get the single one with lowest number of <code>redirects</code>.</p>
  
  <p>Any help would be greatly appreciated.</p>