Thomas Spahni wrote:
Hi suomi,
it can be done with a temporary table. See the following example.
Regards,
Thomas Spahni
CREATE TEMPORARY TABLE duptemp SELECT * FROM duprows WHERE id = 2;
ALTER TABLE duptemp CHANGE id id INT NULL;
UPDATE duptemp SET id = NULL;
INSERT INTO duprows SELECT * F
Hi suomi,
it can be done with a temporary table. See the following example.
Regards,
Thomas Spahni
USE test;
CREATE TABLE duprows (
id INT NULL AUTO_INCREMENT PRIMARY KEY,
content VARCHAR(255)
) TYPE=MyISAM;
INSERT INTO duprows VALUES(NULL, 'some text'),(NULL, 'some other text
If you want to have all values except the primary key be the same and
say your is foo_ID
You can simply do
INSERT INTO foo
(foo_ID... {rest of columns list})
SELECT new primary key value,
{rest of columns list}
FROM foo
WHERE foo_ID = {primary key value of row you want to copy}
If