title: MySql Stored Procedure and Comma Separated Varchar with In Statement
body: <p>I'm trying to create a stored procedure which will take a comma separated list as a value and push that into a select statement with an IN clause. I'm aware of find_in_set which works, but does have a performance overhead. I've also trialled a prepare statement but the problem remains.</p>
  
  <p>My Example:</p>
  
  <p>My parameter is sp1 and contains the value: 'valuex, valuey, valuez'.</p>
  
  <pre><code>BEGIN
  
      set @sql = concat('select *  from tablename WHERE assignedTo in (', sp1, ')');
  
      PREPARE q FROM @sql;
  
      execute q;
  
  END
  </code></pre>
  
  <p>As expected, this throws an error since SQL will treat the value as column names. My question is how do I achieve: 'valuex','valuey','valuez' FROM 'valuex, valuey, valuez'?</p>