This topic is locked

Any way to move over an entire table of data in one shot?

10/11/2010 5:27:00 PM
PHPRunner General questions
K
karmacomposer author

I know you can move over data to another table, but I also noticed you need to do it field by field.
Is there anyway to use wildcards (like .) to move all fields over to a new record in another table (with identical structure)?
As per the manual:
==========================================================================================
global $conn;

$strSQLInsert = "insert into CandidateTemp (Field1, Field2) values (Value1, Value2)";

db_exec($strSQLInsert,$conn);
==========================================================================================
Now, there are over 30 fields in this one table and I need to move over the entire record. Is there any way to move the entire record?
Mike

Sergey Kornilov admin 10/11/2010
INSERT INTO `table2` SELECT * FROM `table1` WHERE KeyColumn=... ;


Check MySQL docs for more info:

http://dev.mysql.com/doc/refman/5.0/en/ansi-diff-select-into-table.html