MySQL Forums
Forum List  »  Newbie

Temp table (newbie)
Posted by: Ciaran O'Neill
Date: April 01, 2005 03:01PM

Hi,

I want to use temp tables to generate a results set for a query. I want to combine data from several tables into the one temp table. I'm using the following code:

CREATE TEMPORARY TABLE mytmp ( name varchar(200), descr varchar(200) ) TYPE=HEAP;
INSERT INTO mytmp (name, descr) VALUES SELECT name, description FROM forum;
INSERT INTO mytmp (name, descr) VALUES SELECT login, email FROM users;
SELECT * FROM mytmp;

This is just a spurious basic sample, but I'm getting the following errors:

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT name, description FROM forum' at line 1

And

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT login, email FROM users' at line 1

Any help is much appreciated

Ciaran.

Options: ReplyQuote


Subject
Written By
Posted
Temp table (newbie)
April 01, 2005 03:01PM
April 01, 2005 05:40PM
April 04, 2005 07:13AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.