title: Concatenate table name on UPDATE statement using MySQL user-defined variable
body: <p>I am trying to set the prefix on table names for an <code>UPDATE</code> statement. I have to run this <code>UPDATE</code> statement dozens of times on multiple databases, each has a different table prefix.</p>
  
  <p>The code below does not work, but this is the idea of what I am trying to accomplish.</p>
  
  <pre><code>SET @prefix = 'prefix_';
  SET @old = "old_value";
  SET @new = "new_value";
  UPDATE CONCAT(@prefix, 'table1') SET some_field = REPLACE(some_field, @old, @new);
  UPDATE CONCAT(@prefix, 'table2') SET some_field = REPLACE(some_field, @old, @new);
  UPDATE CONCAT(@prefix, 'table3') SET some_field = REPLACE(some_field, @old, @new);
  </code></pre>
  
  <p>Written manually would be...</p>
  
  <pre><code>UPDATE prefix_table1 SET some_field = REPLACE(some_field, 'old_value', 'new_value');
  UPDATE prefix_table2 SET some_field = REPLACE(some_field, 'old_value', 'new_value');
  UPDATE prefix_table3 SET some_field = REPLACE(some_field, 'old_value', 'new_value');
  </code></pre>