 <p>I think you might be trying to do the first case outlined here:</p> <p><a href="http://dev.mysql.com/doc/refman/5.5/en/create-table-select.html" rel="nofollow">http://dev.mysql.com/doc/refman/5.5/en/create-table-select.html</a></p> <p>..which for your example would look like:</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>..so it might just be the parens in the wrong places that bit you in your first try.</p>