mysql表与表之间数据的转移

1.相同表结构INSERT INTO table1 SELECT * FROM table2;2.不同表结构INSERT INTO table1(filed1,…,filedn) SELECT table2.filed1,…,table2.filedn FROM table2;3.如果是不同数据库之间,参考以下:INSERT into db_ds_edu.t_exam_student(stu_id,stu_numbe

1.相同表结构

INSERT INTO table1 SELECT * FROM table2;

2.不同表结构

INSERT INTO table1(filed1,…,filedn) SELECT table2.filed1,table2.filedn FROM table2;

3.如果是不同数据库之间,参考以下:

INSERT into db_ds_edu.t_exam_student(stu_id,stu_number,stu_name,school_id,campus_id,grade_id,class_id,xuebu_id) SELECT stu.id,stu.student_num,person.name,stu.school_id,stu.campus_id,stu.grade_id,stu.clas_id,stu.xuebu_idFROM db_ds.t_stu_info AS stu,db_ds.t_p_person_info as person WHERE stu.person_id = person.id——————— 作者:清无时空 来源:CSDN 原文:https://blog.csdn.net/sinat_34439107/article/details/70214335 版权声明:本文为博主原创文章,转载请附上博文链接!

作者: dawei

【声明】:永州站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。

为您推荐

联系我们

联系我们

0577-28828765

在线咨询: QQ交谈

邮箱: xwei067@foxmail.com

工作时间:周一至周五,9:00-17:30,节假日休息

返回顶部