Is the implementation of this different than the docs say? According to the manual, I didn't think this would work:

"* The target table of the INSERT statement cannot appear in the FROM clause of the SELECT part of the query because it's forbidden in ANSI SQL to SELECT from the same table into which you are inserting."
- http://www.mysql.com/doc/en/INSERT_SELECT.html

On Thursday, November 7, 2002, at 08:56 PM, Alan McDonald wrote:

insert into mytable(field1, field2, field3) select field1, field2, newvalue
from mytable where productcode=xx

-----Original Message-----
From: Doug Coning [mailto:lists@;coning.com]
Sent: Friday, 8 November 2002 14:35
To: [EMAIL PROTECTED]
Subject: Copy Records in a table...


Hi everyone,

I'm still learning MySQL. I have a database of 600 items. I am still
adding products. Several of these products are identical in nature, but
have maybe one or two columns that are different. Is there a way
to write a
SQL command that selects these items and then inserts them, and
then updates
them respectively with one command?

Thanks,

Doug

---------------------------------------------------------------------
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to