The two databases in mysql have different table structures. how to import data from one table to another?-php Tutorial

Source: Internet
Author: User
Mysql databases have different table structures. how can we import data from one table to another? mysql & nbsp; databases have different table structures, how can I import data from one table to another? Solution: ------------------ check the data in Table A. after php processing, fill the specified field with custom items or retrieve the extra fields. mysql databases the structure of the table is different, how to import data from one table to another
Mysql databases have different table structures. how can we import data from one table to another?


------ Solution --------------------
After checking the fields in table A in php, fill the specified fields with custom items or retrieve the extra fields and then put them into Table B.
------ Solution --------------------
How can this problem be solved?
The structure of the two tables is given, and the fields of the table to be imported to the other table are described.

------ Solution --------------------
I'm going to. in this data table, have you put all the fields in one table with so many fields?
------ Solution --------------------
You didn't give which field to put in which field
------ Solution --------------------
Reference:
For example, put companyaddr in the jobinfo table into m_address in the job_hr table.

You have already completed most of the work.
For example
Insert into job_hr (m_address) values select companyaddr from jobinfo

------ Solution --------------------

This post was last edited by xuzuning at 06:50:08

Insert into job_hr (database 1. m_address) values select companyaddr from Database 2. jobinfo

Of course, you cannot add them one by one, that is, add them.

Insert into library 1. job_hr (field list) list of fields corresponding to values select from Library 2. jobinfo


------ Solution --------------------
Table update based on the master key
------ Solution --------------------
Reference:
Insert into job_hr (database 1. m_address) values select companyaddr from Database 2. jobinfo

Of course, you cannot add them one by one, that is, add them.

Insert into library 1. job_hr (field list) list of fields corresponding to values select from Library 2. jobinfo

11 # experts ~ So if the data types are different, for example, if both of them are char, can they?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.