title: SQL select command using string with comma separated IDs
body: <p>I have a string in PHP like:</p>
  
  <pre><code>"1234,2345,4567,5676,234,12,78957".....
  </code></pre>
  
  <p>I want to extract these numbers in varchar(30) format and use them on a command like</p>
  
  <pre><code>SELECT * FROM TABLE_NUM WHERE ID LIKE '%NUM';
  </code></pre>
  
  <p>where NUM will have above mentioned 7 strings. </p>
  
  <p>And if possible i would also like to restrict '%' in '%NUM' to 1-5 characters only i.e. the prefix should not be greater than 5 characters. Example NUM = 1234 and ID has (31234,5678956781234) it should only provide first one as result and not the other one.</p>
  
  <p>Accordingly I will get a merged result of all matching rows.</p>
  
  <p>How can I achieve this ?</p>
  
  <p>Thank You!</p>