[Pugged] MySql Primary Keys

Tim Perdue ciapug@ciapug.org
Mon, 13 Jan 2003 20:53:05 -0600


Dave J. Hala Jr. wrote:
> I'm using  the following statement to move some records from one table
> to another:
> 
> INSERT INTO target_table SELECT * FROM source_table where LHP = "A";

You know one thing you can do is:

INSERT INTO target_table (field2,field3,field4) SELECT 
field2,field3,field4 FROM source_table where LHP = "A";

Notice how you are leaving out the pkey? Mysql will autnumber that field 
on its own.

Tim