title: MySQL stored procedure return variable values from seconds query?
body: <pre><code>SET @v1 = '';
  SET @v2 = '';
  
  SET @Query = CONCAT('SELECT sum(colName1), sum(colName2) INTO @v1, @v2 FROM tableName WHERE id=1 ');
  PREPARE stmt FROM @Query;
  
  EXECUTE stmt;
  DEALLOCATE PREPARE stmt;
  
  SET @Query = CONCAT('SELECT id, name,',@v1,' as value1, ',@v2,' as value2 FROM tableName WHERE id=1 ');
  PREPARE stmt FROM @Query;
  
  EXECUTE stmt;
  DEALLOCATE PREPARE stmt;
  </code></pre>
  
  <p>While reading values the throw an Exception - <strong>Column 'value1' does not belong to table.</strong></p>
  
  <p>How can I get the value of @v1 and @v2.</p>
  
  <p>Please help me.</p>