title: How do I run a CONCAT on query stored in a database
body: <p>I know this is a bad example but I'm trying to simplify things so bear with me in the round-about way this code is written.  Say I have queries stored in a database such as</p>
  
  <h2>queries table</h2>
  
  <pre><code>id    query
  1     concat('SELECT * FROM table1 WHERE year = ', _year, 'order by name')
  2     concat('SELECT * FROM table2 WHERE year = ', _year, 'order by name')
  </code></pre>
  
  <hr>
  
  <p>and I want to run the following routine</p>
  
  <pre><code>DECLARE _year;
  SET _year= "2013";
  SET @SQL = (SELECT query FROM queries WHERE id = 1);    
  PREPARE stmt FROM @SQL;
  EXECUTE stmt; 
  </code></pre>
  
  <p>this is what I currently have but it's not working.  I'm trying to select a query from the database, pass a few variables into it and then run the query.</p>