title: Select from table depending on entries in other table
body: <p>This is the setup:</p>
  
  <p>Table A has a connection to table B. There are multiple entries (0 to n) in table B that can have a matching record in table A.</p>
  
  <p>How do I form a query that gives me a record from table A only if a certain amount of matching records exist in table B?</p>
  
  <p>Example:</p>
  
  <p>Table A has clothing in it. Table B has attributes for clothing.</p>
  
  <p>Table B has a foreign key to table A so it would look something like this:</p>
  
  <pre><code>id  fid_clothing1  attributeA
  id  fid_clothing1  attributeB
  id  fid_clothing1  attributeC
  id  fid_clothing2  attributeA
  id  fid_clothing2  attributeB
  </code></pre>
  
  <p>Now, I want only the clothes which have attribute <code>attributeA</code> AND <code>attributeB</code> AND <code>attributeC</code>. This is not a problem if I do a OR-query but I can't just do something like:</p>
  
  <pre><code>SELECT * from tableA
  LEFT JOIN tableB on tableB.fid_cloting = tableA.id
  WHERE attribute='A' AND attribute='B' AND attribute='C'
  </code></pre>
  
  <p>This condition will never evaluate to true. How do I do that?</p>