Re: INSERT INTO table1 SELECT FROM table2...

From: Date: Sun, 26 Nov 2000 17:12:20 +0000
Subject: Re: INSERT INTO table1 SELECT FROM table2...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-27268@lists.php.net to get a copy of this message
Hello Siim, On 26-Nov-00 10:26:34, you wrote: >INSERT INTO a_main SELECT * FROM main WHERE something='something' >is it possible in theory? it gives me wrong paramete count error, but at >the same time the tabels should be identical. Which might cause the >probleme, is the primary key and auto_increment field in the target table, >but I changed that, I deleted the primary key line from the a_main and >deleted the auto_increment atribute from the first line as well. But the >result is the same. What might be causing the problem? > Yes, possibly I could write it all down like INSERT INTO a_main >(col1,col2,etc) SELECT col1,col2,etc FROM main, but as I have about 10 >tables and in all of them I have about 20 fields and I need to archive >them all together with a mouse click....this would just be too painful to >write it all out. > What are your suggestions? This is possible in any SQL 92 compliant DBMS, but not in MySQL because it doesn't support sub-queries yet. Regards, Manuel Lemos Web Programming Components using PHP Classes. Look at: http://phpclasses.UpperDesign.com/?user=mlemos@acm.org -- E-mail: mlemos@acm.org URL: http://www.mlemos.e-na.net/ PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp --

« previous php.general (#27268) next »