title: Split strings using mysql
body: <p>I want to create a stored procedure which will do matching of two tables. My requirement is to match two tables based on the columns user passes as an input.</p>
  
  <p><strong>Syntax:</strong></p>
  
  <pre><code>CREATE PROCEDURE reconcile.matchTables(
    IN TAB1 VARCHAR(25), 
    IN TAB1 VARCHAR(25), 
    IN COLS1 VARCHAR(250) , 
    IN COLS2 VARCHAR(250))
  </code></pre>
  
  <p><strong>EX:</strong> </p>
  
  <pre><code>matchTables('table1', 'table2', 'col1#col2#col3#col4' , 'col2#col13#col1#col8')
  </code></pre>
  
  <p>Now the stored procedure should form the where clause like the following </p>
  
  <pre><code>table1.col1 = table2.col2 
    and table1.col2 = table2.col13 
    and table1.col3 = table2.col1 
    and table1.col4 = table2.col8
  </code></pre>