title: MYSQL Finding server with failed status
body: <p>I have sql table with following columns <code>id</code> as <code>PK</code>, <code>ip</code>, <code>check_type</code> <code>check_status</code>:</p>
  
  <pre><code>id      ip             check_type    check_status
  1       10.10.10.10    check1        FAIL
  2       10.10.10.10    check2        PASS
  3       10.10.10.11    check1        PASS
  4       10.10.10.11    check2        PASS
  </code></pre>
  
  <p>I want only the <code>ips</code> which have <code>Failed Check1 and Passed Check2</code> from the table.
  So, from above example my output should be <code>10.10.10.10</code></p>
  
  <pre><code>SELECT DISTINCT
    (ip)
  FROM table1 a
  INNER JOIN table1 b
    ON a.ip = b.ip
  WHERE a.check_status = 'FAIL'
  AND a.check_type = 'check1'
  AND b.check_status = 'PASS'
  AND b.check_type = 'check2';
  </code></pre>
  
  <p>I am getting an error </p>
  
  <blockquote>
    <p>column ip is ambiguous</p>
  </blockquote>