Data from table A into table B

Discussion in 'MySQL' started by davidjmorin, Oct 25, 2009.

  1. #1
    hi all. im looking to import data from we will call it user and import it into table member.

    basically i have two different databases using different forum software. forum A uses "user" as a table name and forum B uses "member"

    How can i import this into the single database and reserve all the data?

    Thanks for all the help
     
    davidjmorin, Oct 25, 2009 IP
  2. heavydev

    heavydev Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    http://www.w3schools.com/Sql/sql_select_into.asp

    you can use the select into command with mysql to map fields from one table into another. This tutorial should help you get the results you need, although I'm sure if you posted both table schemas here someone would be glad to help you out
     
    heavydev, Oct 25, 2009 IP
  3. koba

    koba Peon

    Messages:
    88
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Find correct field names, fix next query and use it:

    INSERT INTO member_table (user_id, user_name) SELECT user_id, user_name FROM user_table;
     
    koba, Oct 28, 2009 IP
  4. Chocolate Lime

    Chocolate Lime Active Member

    Messages:
    399
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #4
    As long as the datatypes are the same, a SELECT INTO will work fine.
     
    Chocolate Lime, Oct 29, 2009 IP