INSERT INTO table1 SELECT FROM table2...

From: Date: Sun, 26 Nov 2000 13:28:26 +0000
Subject: INSERT INTO table1 SELECT FROM table2...
Groups: php.general 
Request: Send a blank email to php-general+get-27259@lists.php.net to get a copy of this message
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? Thanks Siim

« previous php.general (#27259) next »