/ Published in: SQL
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
INSERT INTO MYTABLE SELECT * FROM MYTABLE /** * You can use WHERE clause too */ INSERT INTO MYTABLE SELECT * FROM MYTABLE WHERE something=something /** * If you have an unique index... for exmaple id */ INSERT INTO MYTABLE (field1, field2, ...) SELECT field1, field2,... FROM MYTABLE /** * If you have to change some value... */ INSERT INTO MYTABLE (field1, field2, ...) SELECT (field1+1), field2,... FROM MYTABLE
URL: http://www.undolog.com/2009/01/07/very-short-trick-duplicare-o-clonare-una-o-pia-righe-in-mysql/