title: How to select 1 Row in MySQL Master Table Based on 2 Conditions Existing in a Detailed Table
body: <p>I have 2 tables -- master and detail</p>
  
  <p>Table A is Master and contains unique rows</p>
  
  <pre><code>ID Name
  1  Abc
  ...
  7  Def
  ...
  19 Xyz
  </code></pre>
  
  <p>Table B is Detail and contains multiple rows per each master row</p>
  
  <pre><code>Ref ID  Desc
  1   10  abcdef
  1   15  ghijk
  1   20  lmnop
  ...
  7   05  qrstu
  7   10  vwxyz
  7   15  ygfdt
  7   20  kjqts
  ...
  19  05  htyge
  19  15  gqwes
  </code></pre>
  
  <p>Query Result -- I only wish to select Master Rows that have detailed rows containing both a related detail row of "10" and "15"</p>
  
  <p>So only Rows 1 and Row 7 would be selected.</p>
  
  <p>Thanks for helping.</p>
  
  <p>Here's the shell of my query:</p>
  
  <pre><code>$query_string = '
    SELECT a.ID, Name
    FROM table_a AS a
    LEFT JOIN table_b AS b ON b.ref = a.ID
    WHERE b.ID = "10" AND b.ID = "15"
  ';
  </code></pre>