Re: [PHP-DB] copy tables between db's
Jeremy wrote: I need to copy some tables from one mysql database to another mysql database on the same server. I looked at the php manual and couldn't find it...I found stuff on mysqlhotcopy, but it doesn't look like that will do what I need it to do, or maybe I'm reading the manual wrong. Can someone please show me how to do this? To be specific, it's just a table with a list of US states in it... table name: states fields: state_id, name, abbreviation How about CREATE TABLE database2.states SELECT state_id, name, abbreviation FROM database1.states; Then add your indexes. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] copy tables between db's
David Smith wrote: insert into database1.tablename select * from database2.tablename; database1 and database2 are the names of the two databases. tablename is the name of the table you want to copy from database1 to database2. Correction: from database2 to database1, not vice versa. --Dave -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] copy tables between db's
Have you tried something like this: insert into database1.tablename select * from database2.tablename; database1 and database2 are the names of the two databases. tablename is the name of the table you want to copy from database1 to database2. In your case I guess this would be: insert into database1.states select * from database2.states; Good luck! --Dave Jeremy wrote: I need to copy some tables from one mysql database to another mysql database on the same server. I looked at the php manual and couldn't find it...I found stuff on mysqlhotcopy, but it doesn't look like that will do what I need it to do, or maybe I'm reading the manual wrong. Can someone please show me how to do this? To be specific, it's just a table with a list of US states in it... table name: states fields: state_id, name, abbreviation Thanks, Jeremy -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] copy tables between db's
I need to copy some tables from one mysql database to another mysql database on the same server. I looked at the php manual and couldn't find it...I found stuff on mysqlhotcopy, but it doesn't look like that will do what I need it to do, or maybe I'm reading the manual wrong. Can someone please show me how to do this? To be specific, it's just a table with a list of US states in it... table name: states fields: state_id, name, abbreviation Thanks, Jeremy -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php