you want to create a temporary table with the auto_increment field plus the field that you want to select from another table.
Here is what I have (doesn't work)
CREATE TEMPORARY TABLE tmp (id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, (SELECT valueName AS valueName FROM sometable WHERE sometable.somevalue='00'));
they work on their own, but can get the correct syntax to do both
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';
source share