Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Temporary Table on MySQL

Status
Not open for further replies.

aas1611

Programmer
Dec 14, 2001
184
DE
Does anybody know how to create a temp table on MySQL without creating it on the database?

in MS SQL it has something like:

select ...
into #T1 -- this is a temp table
from ...

then, I want to call this #T1 later on the same query window.

Is there an equal command in MySQL?

Please help!
 
You could use:
[tt]
CREATE TEMPORARY TABLE temptbl AS
SELECT ...
[/tt]
The table will be created in memory and dropped when the connection ends.
 
Temporary tables also have the benefit of being in an isolated namespace. So multiple users in the same database can create temp tables of the same name at the same time without interfering with each other.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top