title: Multiple dynamic FIND_IN_SET searches
body: <p>So, I have an array like this in my programming language:</p>
  <pre><code>$animalsToSearch = ['fox', 'cat', 'dog'];
  </code></pre>
  <p>And I have a MySQL database table like this:</p>
  <pre><code>id  | value
  ----+----------------
  1   | dog,elephant
  2   | cat,dog
  3   | spider,fox,cat
  4   | cat
  5   | dog,rabit
  </code></pre>
  <p>Unfortunately, I cannot change the table to be more relational (yet).</p>
  <p>I want to pull out how many times an item in my array is present in the database <code>value</code> column. Now, the obvious way to do this would be something like:</p>
  <pre><code>&lt;?php
  $count = [];
  
  foreach (['fox', 'cat', 'dog'] as $animal) {
      $count[$animal] = some_function_that_gets_the_data($animal);
  }
  </code></pre>
  <p>But there might be dozens of animals to search for, and I don't want to send a db request per animal. I have thought of the way below, and then using PHP to look at the values to see if the animal is present within... but it's a bit hacky. Might there be a better way?</p>
  <pre><code>select
      `value`
  from
      `animal`
  where
         find_in_set('fox', value)
      or find_in_set('cat', value)
      or find_in_set('dog', value);
  </code></pre>
  <hr />
  <p>ysth's solution <code>explain</code>'d</p>
  <pre><code>id  select_type  table       partitions    type  possible_keys  key   key_len  ref    rows       filtered  Extra
  1   PRIMARY      &lt;derived2&gt;  NULL          ALL   NULL           NULL  NULL     NULL   2          100.00    Using temporary; Using filesort
  1   PRIMARY      animal      NULL          ALL   NULL           NULL  NULL     NULL   1,879,296  100.00    Using where; Using join buffer (Block Nested Loop)
  2   DERIVED      NULL        NULL          NULL  NULL           NULL  NULL     NULL   NULL       NULL      No tables used
  3   UNION        NULL        NULL          NULL  NULL           NULL  NULL     NULL   NULL       NULL      No tables used
  </code></pre>