create temporary table tmp
(
id int unsigned not null,
name varchar(32) not null
)
engine=memory; -- change engine type if required e.g myisam/innodb
insert into tmp (id, name) select id, name from foo... ;
-- do more work...
select * from tmp order by id;
drop temporary table if exists tmp;
atau
create temporary table tmp engine=memory select id, name from foo... ;
-- do more work...
select * from tmp order by id;
drop temporary table if exists tmp;