List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:September 11 2004 2:02am
Subject:Re: Copy a record
View as plain text  
At 16:59 -0700 9/10/04, Dan Sashko wrote:
>hi, a quick question.
>
>is there a way to duplicate a record (without knowing fields in advance) in
>sql alone?
>the only thing is know is that `id` is a primary key (autonumber)
>
>something of this sort:
>
>INSERT INTO the_table
>SELECT * FROM the_table
>WHERE id=the_number
>
>this fails due duplicate entry for the primary key. Is there way to select *
>minus the id field?

You can name all the columns except that one.

But why do you have a primary key if you want to allow duplicate values?


-- 
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com
Thread
Copy a recordDan Sashko11 Sep
  • Re: Copy a recordPaul DuBois11 Sep