title: SQL: Select exactly two rows with a matching ID based on two given values
body: <p>What I need seems kind of complicated, but then again I'm not that good at SQL. Basically I have a table that stores conversation participants. I need a query that will, using two provided User IDs, determine if a conversation exists containing ONLY the two given users. Conversations containing additional users beyond just these two shouldn't be counted---only a single 1-on-1 conversation between the two given users.</p>
  
  <p>Here is my SQLfiddle: <a href="http://sqlfiddle.com/#!9/284e1/33/0" rel="nofollow noreferrer">http://sqlfiddle.com/#!9/284e1/33/0</a></p>
  
  <p>And my in-progress query which isn't doing the trick:</p>
  
  <p><code>SELECT * 
  FROM mybb_conversation_participants
  WHERE conversation_id IN (
      SELECT conversation_id
      FROM mybb_conversation_participants
      WHERE (user_id = 6 OR user_id = 11)
      GROUP BY conversation_id
      HAVING COUNT(*) = 2
  );</code></p>
  
  <p>I don't think I'm understanding the <code>HAVING COUNT(*) = 2</code> part, because this query returns all conversations containing the two users, even if other users exist in that conversation as well. Again, only 1-on-1 conversations between the two provided users should be selected, otherwise the query should select nothing. For example, in the SQLfiddle above, only rows with a <code>conversation_id</code> of <code>12</code> or <code>19</code> should've returned, since all the other matches include more than two rows.</p>
  
  <p>That is what I was hoping the <code>HAVING</code> statement would do, but apparently not.</p>
  
  <p>Any ideas?</p>