title: Mysql: find 1 row in table1 that joins multiple rows in table2 with given values
body: <p>Sorry for question title.. I have no idea how to write it down in more clear way.</p>
  
  <p>So, I have theree tables:</p>
  
  <ol>
  <li><code>tracks</code>, contains <code>id</code> (track id) &amp; <code>name</code> (track name)</li>
  <li><code>tags</code>, contains <code>id</code> (tag id) &amp; <code>name</code> (tag name)</li>
  <li><code>track_tags</code>, contains <code>track_id</code> &amp; <code>tag_id</code></li>
  </ol>
  
  <p>I have to find all tracks, that have all tags, specified in list (for example i need to find all tracks, that have 'rock', 'pop' and 'dance' tags at one time).</p>
  
  <p>Previously, i has solved similar issue, but finding all tracks with at least 1 tag match. It was quite easy:</p>
  
  <pre><code>SELECT tracks.* 
  FROM tags 
  INNER JOIN track_tags ON tags.id = track_tags.tag_id 
  INNER JOIN tracks ON track_tags.track_id = tracks.id 
  WHERE tags.name IN('pop', 'rock', 'dance')
  GROUP BY tracks.id
  </code></pre>
  
  <p>But i have quite no idea how to find all tracks, that match exactly all tags from the list.</p>
  
  <p>I thought about retrieving all tracks and all their tags to my app and filter tracks there - but there are quite lot of them (hundreds of thousands), app is also using pagination, that can be implemented easily using LIMIT in the upper query.</p>
  
  <p>Perhaps it can be done another way, using mysql features? I am really frigtened that selecting all tracks with all tags and filtering them on the app side will kill web server.</p>