At 9:00 -0700 10/11/05, Brian Dunning wrote:
INSERT into tbl1 SELECT * FROM tbl2

Thanks to both of you, but this is not working. Since one of the fields is a primary key that's duplicated in both tables (both tables have records numbered 1, 2, 3...), it won't allow the duplicate entries. Fortunately I do not need those primary key values to be preserved - it's OK to insert the new records with auto-increment values where the target table left off. So I tried:

insert into target_table select `field1`,`field2` from original_table;

and I listed all but the auto-increment field. This doesn't work either, it just says to check my syntax, but I can't see a problem. Any ideas?

The manual is your friend:

http://dev.mysql.com/doc/mysql/en/insert-select.html

--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to