title: Mysql intersect two strings
body: <p>I have the following tables:</p>
  
  <pre><code>TableFinal
  
  column id, with first row having value 1
  column numbers, with first row having value `1,5,6,33,2,12,3,4,9,13,26,41,59,61,10,7,28`
  </code></pre>
  
  <p>And </p>
  
  <pre><code>TablePick
  
  column id, with first row having value 1
  column numbers, with first row having value 2,12,26,33
  </code></pre>
  
  <p>I want to check if the numbers from TablePick, column "selected" are contained in the column "numbers" of TableFinal.</p>
  
  <p>I have to mention that in TablePick, the numbers in column "selected" are ordered ASC, while in TableFinal, the numbers in column "numbers" are shuffled.</p>
  
  <p>Usually I would put each of these in an array using PHP and then intersect the 2 arrays and count the resulted array. But in MYSQL, it is not that simple, so practically I have no idea where to start.</p>
  
  <p>Maybe I should create an ARRAY_INTERSECT function? Or do we have a simpler solution?</p>
  
  <pre><code>SELECT * FROM TablePick p RIGHT JOIN TableFinal f ON f.id=p.id WHERE ARRAY_INTERSECT(p.selected,f.numbers)
  </code></pre>