Hi
I have two tables, addresses_old and addresses_new - I want to transfer the data from addresses_old into addresses_new - the schema for each table is different, see below:
I want to copy all columns address1, address2, address3 from addresses_old into address in addresses_new table. How do I do this?
I have tried a simple insert, like:
But this only inserts the address1 column, how do I insert all of them at once?
Any help much appreciated. Thanks.
by Lastwords,
Maentwrog (n.Welsh): Celtic word for a computer spelling mistake.
I have two tables, addresses_old and addresses_new - I want to transfer the data from addresses_old into addresses_new - the schema for each table is different, see below:
Code:
CREATE TABLE `addresses_old` (
`key` int(11) NOT NULL,
`address1` varchar(32) default NULL,
`address2` varchar(32) default NULL,
`address3` varchar(32) default NULL,
PRIMARY KEY (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `addresses_new` (
`address_id` int(11) NOT NULL auto_increment,
`address` varchar(32) default NULL
PRIMARY KEY (`address_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
I have tried a simple insert, like:
Code:
INSERT INTO addresses_new (address)
SELECT addresses_old.address1
Any help much appreciated. Thanks.
by Lastwords,
Maentwrog (n.Welsh): Celtic word for a computer spelling mistake.