1
mudone 2012-07-18 12:19:54 +08:00 1
create TEMPORARY table tmptable like table;
insert into tmptable select * from table order by id desc limit 1; alter table tmptable drop id; insert into table select '',tmptable.* from tmptable; 备注:仅仅为了解决clone,没有考虑其他因素,酌情使用。 |
2
august OP @mudone 感谢你的回复。
发贴后没多久,我在 http://www.av8n.com/computer/htm/clone-sql-record.htm 里找到个方法,跟你的差不多,都是先建个临时表。再次感谢。 CREATE TEMPORARY TABLE chan2 ENGINE=MEMORY SELECT * FROM channel WHERE chanid=21051; UPDATE chan2 SET chanid=21109; ## Change the unique key ## Update anything else that needs to be updated. INSERT INTO channel SELECT * FROM chan2; DROP TABLE chan2; |