Re: HELP: How to duplicate rows...
At 09:39 AM 12/7/2007, rfeio wrote: INSERT INTO table1 (field2, field3, field4) SELECT field2, field3, field4 WHERE field2=x Have you tried: INSERT INTO table1 (field2, field3, field4) SELECT field2, field3, ABCD WHERE field2=x Mike -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: HELP: How to duplicate rows...
u want something like this INSERT INTO table1 (field2, field3, field4) SELECT field2, field3, 'abcd' from table_name WHERE field2=x On 12/7/07, rfeio [EMAIL PROTECTED] wrote: 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! -- View this message in context: http://www.nabble.com/HELP%3A-How-to-duplicate-rows...-tf4962682.html#a14214522 Sent from the MySQL - General mailing list archive at Nabble.com. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: HELP: How to duplicate rows...
I knew it had to be something REAL simple! :-) Thanks guys, that worked perfectly! Ananda Kumar wrote: u want something like this INSERT INTO table1 (field2, field3, field4) SELECT field2, field3, 'abcd' from table_name WHERE field2=x On 12/7/07, rfeio [EMAIL PROTECTED] wrote: 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! -- View this message in context: http://www.nabble.com/HELP%3A-How-to-duplicate-rows...-tf4962682.html#a14214522 Sent from the MySQL - General mailing list archive at Nabble.com. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/HELP%3A-How-to-duplicate-rows...-tf4962682.html#a14216439 Sent from the MySQL - General mailing list archive at Nabble.com. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]