450   MySQL

大体思路
1,先创建临时表,把原始表中需要复制的记录保存到临时表
2,清空临时表的自增key,唯一key等
3,把临时表的记录插入到原始表中
4,删除临时表

CREATE TEMPORARY TABLE tmptable_1 SELECT * FROM table WHERE primarykey = 1;
UPDATE tmptable_1 SET primarykey = NULL;
INSERT INTO table SELECT * FROM tmptable_1;
DROP TEMPORARY TABLE IF EXISTS tmptable_1;

参考连接




Leave a Reply

Your email address will not be published. Required fields are marked *