Re: SELECT ... INTO OUTFILE ... and LOAD DATA INFILE ... with a key

2005-08-19 Thread Michael Stassen
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

Re: SELECT ... INTO OUTFILE ... and LOAD DATA INFILE ... with a key

2005-08-19 Thread Thomas Spahni
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

RE: SELECT ... INTO OUTFILE ... and LOAD DATA INFILE ... with a key

2005-08-19 Thread Gordon Bruce
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