RE: [PHP] Move data from one MySql table to another?
| From: | Altunergil, Oktay | Date: | Fri, 23 Mar 2001 18:44:08 +0000 |
| Subject: | RE: [PHP] Move data from one MySql table to another? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-45322@lists.php.net to get a copy of this message | ||
from the docs;
The following will not yet work in MySQL:
SELECT * FROM table1 WHERE id IN (SELECT id FROM table2);
SELECT * FROM table1 WHERE id NOT IN (SELECT id FROM table2);
SELECT * FROM table1 WHERE NOT EXISTS (SELECT id FROM table2 where
table1.id=table2.id);
.
.
.
MySQL only supports INSERT ... SELECT ... and REPLACE ... SELECT ...
Independent sub-selects will probably be available in Version 4.0. You can
now use the function IN() in other contexts, however.
-----Original Message-----
From: Boget, Chris [mailto:Chris.Boget@wild.net]
Sent: Friday, March 23, 2001 1:41 PM
To: 'James Atkinson'; YoBro
Cc: Php-General@Lists.Php.Net
Subject: RE: [PHP] Move data from one MySql table to another?
> To populate new_table from old_table you can give it this SQL:
> INSERT INTO new_table (name, address) VALUES SELECT name, address FROM
> old_table;
Umm, I didn't think you could do subselects in MySQL?
Or am I missing something?
Chris