create temporary table foo as select id as id, person as person from mytable in (select id from person)