[轉]Mysql復制一條或多條記錄並插入表|mysql從某表復制一條記錄到另一張表


一、復制表里面的一條記錄並插入表里面

insert into article(title,keywords,desc,contents) select
title,keywords,desc,contents from article where article_id = 100;

二、復制表里的多條數據/記錄,並插入到表里面

INSERT INTO `power_node`(title,type,status) SELECT title,type,status FROM
power_node WHERE id < 5;
    ② INSERT into jiaban
(num,overtime) SELECT num,overtime from jiaban where id
IN(1,3,5,6,7,9);

三、在創建表時,就插入另一張表里面的某些數據

create table user AS select * from member where id < 10

From: https://www.cnblogs.com/sky20080101/p/6902040.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM