Re: Copying a set of database records

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You could use sql to copy that info to a separate temporary table, then update the temp table with the new data and then another call to update the main table with the new product info from the the temp table....


Bastien

From: Jesper Goos <jesper@xxxxxxxxxx>
To: Steve McGill <steve@xxxxxxxxxxxxx>
CC: php-db@xxxxxxxxxxxxx
Subject: Re:  Copying a set of database records
Date: Fri, 04 Mar 2005 16:57:46 +0100

Hi

It can't be done in a single SQL query as SQL can't make recursive requests.
You will have to use PL/SQL, and I don't think MySql supports that.


Jesper


Steve McGill wrote:

A sort of similar question to my last one:

I have a table with about 100 records all related to one product.
I want to create a new product, based on the details from the old product.

So in PHP, I would fetch the 100 records, alter the productID, and then
insert it 100 in 100 separate SQL queries.

Is there any way I can do this in one SQL query, somehow using a combination
of insert and select?


Thanks in advance!
Steve




--

-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux