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


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

insert into reyo(title,keywords,desc,contents) select
title,keywords,desc,contents from reyo where reyo_id = 100;

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

INSERT INTO `reyo`(title,type,status) SELECT title,type,status FROM reyo WHERE id < 5;

INSERT into reyo (num,overtime) SELECT num,overtime from reyo where id IN(1,3,5,6,7,9);

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

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



免責聲明!

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



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