title: Match all WHERE IN values using Kohana ORM
body: <p>I have the following code which gets products based on tags:</p>
  
  <pre><code>self::factory('user_product')
      -&gt;join('items', 'INNER')-&gt;on('user_product.item_id', '=', 'items.id')
      -&gt;join('user_tags', 'INNER')-&gt;on('items.id', '=', 'user_tags.item_id')
      -&gt;join('tags', 'INNER')-&gt;on('user_tags.tag_id', '=', 'tags.id')
      -&gt;where('tags.title', 'IN', $tags)
      -&gt;order_by('items.created_at', 'DESC')-&gt;group_by('items.id')-&gt;find_all();
  </code></pre>
  
  <p>Which generates the following SQL:</p>
  
  <pre><code>SELECT `user_product`.* FROM `user_products` AS `user_product`
  INNER JOIN `items` ON (`user_product`.`item_id` = `items`.`id`) 
  INNER JOIN `user_tags` ON (`items`.`id` = `user_tags`.`item_id`)
  INNER JOIN `tags` ON (`user_tags`.`tag_id` = `tags`.`id`)
  WHERE `tags`.`title` IN ('tag1', 'tag2')
  GROUP BY `items`.`id`
  ORDER BY `items`.`created_at` DESC
  </code></pre>
  
  <p>I would like to modify my query so that it returns only those <code>user_products</code> that have both <code>tag1</code> and <code>tag2</code> (in the where in statement). So I think I need to add the following after the <code>WHERE</code>:</p>
  
  <pre><code>HAVING COUNT(DISTINCT `tags`.`title`) = 2
  </code></pre>
  
  <p>How would I do this using Kohana's ORM, at the moment I have the following but can't work out how to integrate the COUNT and DISTINCT methods:</p>
  
  <pre><code>-&gt;having_open()-&gt;having('tags.title','=','2')-&gt;having_close();
  </code></pre>