carloslaso
asked on
Append content of one table to another
How do I append content of one table to another? They don't identical structure but they have the same number of fields that I need to merge.
I'm tryng to do it using SSH to the server.
I'm tryng to do it using SSH to the server.
ASKER
Is that going to copy the information into the columns? All of the columns on table1 exist on table1 on the other database but has more columns.
I need to copy the information that exist on table1 to table1 on the other database and leave the columns that do not exist on the other database blank.
I need to copy the information that exist on table1 to table1 on the other database and leave the columns that do not exist on the other database blank.
http://dev.mysql.com/doc/refman/5.0/en/insert-select.html
Your best bet might be to export the data from one and then import it into the other.
Are you familiar with perl or anyother programming language?
The columns you select will have to match the order and datatype of the one into which you are inserting.
you could specify the column order
insert into database.table (database.column1,......) (select (1column, 2column, .....) from database2.table where );
Your best bet might be to export the data from one and then import it into the other.
Are you familiar with perl or anyother programming language?
The columns you select will have to match the order and datatype of the one into which you are inserting.
you could specify the column order
insert into database.table (database.column1,......) (select (1column, 2column, .....) from database2.table where );
ASKER
The order and the datatype match but the table on one database has 24 fields, the table on the other database has 29 fields, the 5 extra fields are at the bottom/end of the table.
No, I'm not familiar with any programming languages :-/
No, I'm not familiar with any programming languages :-/
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
mysql -u root -p
insert into <newtable> (select column1,column2, column3,... from old table);