mysql export fields mapping

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jason7899
    New Member
    • Mar 2008
    • 59

    mysql export fields mapping

    hi,
    i have two databases and each one have diferent fields names and tables
    and i want a creat a map for each field and each table and export to a database to the other
    i have tested the mysql migration but i can´t choose a diferent table in the destination
    database.
    any one know a software that does this?
    thanks a lot for your help
    :)
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    You can "copy" a table from one database to another, even if the field names don't match, with a simple INSERT INTO ... SELECT query.

    Code:
    INSERT INTO `db2`.`newTable` (`new1`, `new2`, `new3`)
    SELECT `old1`, `old2`, `old3` FROM `db1`.`oldTable`;
    You could create some sort of a script or application to move the entire database, but seeing as you have to type of the field map anyways you may as well just type out the SQL queries into a .sql file and then execute it.

    Comment

    Working...