title: Return parent records with child records equaling specific values AND where total set of child records for a given parent equal a specific value
body: <p>Currently I have a query that returns parent data for parent records that have a subset of child table records equaling certain values.  However, I want to narrow it to only return those parent records with children having certain values, but where those are the only child records belonging to given parent or where the number of child records don't exceed a given total.</p>
  
  <p>Here's an example query that only gets me half way to where I need to be:</p>
  
  <pre><code>SELECT parent.item1, parent.item2, parent.index
  FROM parent 
  INNER JOIN child on parent.index = child.index 
  WHERE child.value IN (11111111, 33333333)
  GROUP BY parent.item1, parent.item2, parent.index
  HAVING COUNT(child.value) = 2
  </code></pre>
  
  <p>Unfortunately this query returns ANY parent's data that has a subset of the identified values included with the "IN" statement.  I only want the parent's data for parent records whose total child records don't exceed a certain number (or, in my case, don't exceed the number of values in the "IN" statement.  Is there an easy way to accomplish this?</p>