View Single Post

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

Response from Jerry Stuckle <jstucklex@attglobal.net>:

<snip>

>>> This doesn't use a temporary table.
>>>
>>> INSERT INTO tbl_temp2 (fld_id)
>>> SELECT tbl_temp1.fld_order_id
>>> FROM tbl_temp1 WHERE tbl_temp1.fld_order_id > 100;

>>
>> Oh, OK. I must have misunderstood then. What does:
>>
>> "The target table of the INSERT statement may appear in the FROM
>> clause of the SELECT part of the query. (This was not possible in
>> some older versions of MySQL.) In this case, MySQL creates a
>> temporary table to hold the rows from the SELECT and then inserts
>> those rows into the target table."
>>
>> ...pertain to?
>>
>> Thanks again for your help, I appreciate it.

>
> In previous versions of MySQL it was not possible to insert rows
> into the same table they were being selected from. Now it is.


Oh, well, specifically the "In this case..." part. Is it actually
stating that a temporary table (that you can use) is created?

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
Reply With Quote