title: Select on multiple different values of the same field in a many to many relation
body: <p>I'm not the sure the title is really helpful, so here is my problem, here are three tables :</p>
  
  <p>cats :</p>
  
  <pre><code>+-------+--------------+------+-----+---------+----------------+
  | Field | Type         | Null | Key | Default | Extra          |
  +-------+--------------+------+-----+---------+----------------+
  | id    | int(11)      | NO   | PRI | NULL    | auto_increment |
  | name  | varchar(255) | NO   |     | NULL    |                |
  +-------+--------------+------+-----+---------+----------------+
  </code></pre>
  
  <p>tags :</p>
  
  <pre><code>+-------+--------------+------+-----+---------+----------------+
  | Field | Type         | Null | Key | Default | Extra          |
  +-------+--------------+------+-----+---------+----------------+
  | id    | int(11)      | NO   | PRI | NULL    | auto_increment |
  | name  | varchar(255) | NO   |     | NULL    |                |
  +-------+--------------+------+-----+---------+----------------+
  </code></pre>
  
  <p>cats_tags:</p>
  
  <pre><code>+--------+---------+------+-----+---------+----------------+
  | Field  | Type    | Null | Key | Default | Extra          |
  +--------+---------+------+-----+---------+----------------+
  | id     | int(11) | NO   | PRI | NULL    | auto_increment |
  | id_cat | int(11) | NO   |     | NULL    |                |
  | id_tag | int(11) | NO   |     | NULL    |                |
  +--------+---------+------+-----+---------+----------------+
  </code></pre>
  
  <p>let's imagine that the tables are populated by 10 cats, and 5 tags (id 1 to 5) and that those cats are tagged with some random tags each.</p>
  
  <p>how can I select all cats that have an entire list of tags ?</p>
  
  <p>for example how can I list cats with tags 2 and 3 (it could be 1,2 and 3, or 2,3 and 4) but not cats who only have 2 or 3 or none of those two tags ?</p>
  
  <p>I'm not sure it's standard sql, I'd want to do that with mysql.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I tried that :</p>
  
  <pre><code>select
      c.id, c.name
  from
      cats c
  inner join cats_tags r on c.id = r.id_cat
  where
      r.id_tag in (:tags)
  group by c.id
  </code></pre>
  
  <p>unitl I remembered that <em>in</em> would take any cat that has at least of the :tags list I asked for. and I only want cats that has all the tags I gave.</p>