title: MySQL create temporary table with auto_increment id and select query
body: <p>want to create a temporary table that has an auto_increment field plus a field that has to be select from another table. </p>
  
  <p>Here is what I have (does not work)</p>
  
  <pre><code>CREATE TEMPORARY TABLE tmp  (id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
  (SELECT valueName AS valueName
  FROM sometable
  WHERE sometable.somevalue='00'));
  </code></pre>
  
  <p>these work by them selves but can get the right syntax to do both</p>
  
  <pre><code>CREATE TEMPORARY TABLE tmp  (id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
  
  CREATE TEMPORARY TABLE tmp AS SELECT valueName AS valueName FROM sometable
  WHERE sometable.somevalue='00';
  </code></pre>