View Single Post

   
  #2 (permalink)  
Old 02-28-2008, 10:27 AM
Gordon Burditt
 
Posts: n/a
Default Re: Is it possible to QUERY and insert result into another table?

>Basically, I wish to store the result from a SELECT so that I can use
>it or information based on it to insert into another table. Is that
>possible with MySQL so I do not have to reinvent the wheel in the
>application server itself?


You can do it with CREATE [TEMPORARY] TABLE used with a SELECT statement
to populate it.

CREATE TEMPORARY TABLE frootlist (frootid int not null
auto_increment primary key, frootname varchar(30)) SELECT
null as frootid, distinct fruit from fruitbasket_contents;

(Checked for syntax running it on MySQL 5.0.45, not checked for results.)

>This pertains to my original table example of fruits being associated
>with other fruits.
>
>Message-ID: <WvCdnQOuIt7YO2vbnZ2dnUVZ_q_inZ2d@comcast.com>
>
>I thought the query cache was the place to look, but evidently not.


As I understand it, the query cache is not particularly visible
except for performance and commands that configure it.

>And I cannot seem to locate information for "result" or "result set"
>very effectively. I am looking in the CHM version of the latest 5.1
>manual if that makes any difference.



Reply With Quote