Table with 1 row of data :
CREATE TABLE testtable (
id MEDIUMINT NOT NULL AUTO_INCREMENT,
name CHAR(30) NOT NULL,
PRIMARY KEY (id)
INSERT INTO testtable (name) VALUES ('data1');
In the first row 'id' will be '1'
Now I want to copy that row so I get a second row, with all the data the same as the first row, but it should have id '2'
This is what I was thinking of :
INSERT INTO testtable SELECT * FROM testtable WHERE ID=1 ;
But this gives an error, because it tries to insert a value that should be unique.
So is there a way to get around this ? To copy a row and let it have an auto-incremented value at the same time ? Thanks