MySQL Forums
Forum List  »  Quality Assurance

Question: How to duplicate rows...
Posted by: Rui Feio
Date: December 07, 2007 09:35AM

Hi!

I have a table with several rows, some of which I need to duplicate.

The fields of table1 are field1, field2, field3 and field4. Field1 is automatically incremented,
field2 will serve as a filter condition.

Normally to duplicate the rows that matched a certain condition I would do:

INSERT INTO table1 (field2, field3, field4) SELECT field2, field3, field4 WHERE field2=x

This way, I would duplicate the rows that matched the condition and field1 would get it's value automatically incremented by the system.

The catch now is that I want the rows to be duplicated like before, but specifying field4 as "abcd" in all of them.

How can I do this?

Cheers!

Options: ReplyQuote


Subject
Views
Written By
Posted
Question: How to duplicate rows...
42410
December 07, 2007 09:35AM
15850
December 07, 2007 11:17AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.