Re: Error: You can't specify target table '...' for update in FROM clause

2008-02-07 Thread Yves Goergen
On 07.02.2008 03:52 CE(S)T, Chris wrote: If you don't mind a mysql-specific "fix", and can get the data you want from a select query you could: insert into table (select goes here) on duplicate key update; or maybe a replace into ? INSERT/REPLACE ... SELECT will always overwrite the entire r

Re: Error: You can't specify target table '...' for update in FROM clause

2008-02-06 Thread Chris
Yves Goergen wrote: On 06.02.2008 08:12 CE(S)T, Chris wrote: Yves Goergen wrote: My goal was to copy some potentially large BLOB from one record to another in the same table Update table set blob2_field=blob1_field; This does something totally different. ;) See my first posting why. Ah I

RE: Error: You can't specify target table '...' for update in FROM clause

2008-02-06 Thread Jerry Schwartz
> -Original Message- > From: Yves Goergen [mailto:[EMAIL PROTECTED] > Sent: Tuesday, February 05, 2008 6:22 PM > To: Baron Schwartz > Cc: mysql@lists.mysql.com > Subject: Re: Error: You can't specify target table '...' for update in > FROM clause &

Re: Error: You can't specify target table '...' for update in FROM clause

2008-02-06 Thread Yves Goergen
On 06.02.2008 08:12 CE(S)T, Chris wrote: Yves Goergen wrote: My goal was to copy some potentially large BLOB from one record to another in the same table Update table set blob2_field=blob1_field; This does something totally different. ;) See my first posting why. -- Yves Goergen "LonelyPix

Re: Error: You can't specify target table '...' for update in FROM clause

2008-02-05 Thread Chris
Yves Goergen wrote: On 05.02.2008 23:25 CE(S)T, Baron Schwartz wrote: You can't select from a table you're updating at the same time. What "at the same time" means is a bit unclear unless you're one of the MySQL developers ;-) Yes, Paul DuBois already replied to me off-list. Now I found that

Re: Error: You can't specify target table '...' for update in FROM clause

2008-02-05 Thread Yves Goergen
On 05.02.2008 23:25 CE(S)T, Baron Schwartz wrote: You can't select from a table you're updating at the same time. What "at the same time" means is a bit unclear unless you're one of the MySQL developers ;-) Yes, Paul DuBois already replied to me off-list. Now I found that documentation part a

Re: Error: You can't specify target table '...' for update in FROM clause

2008-02-05 Thread Baron Schwartz
Hi, On Feb 5, 2008 11:26 AM, Yves Goergen <[EMAIL PROTECTED]> wrote: > Hi, > > I've got an error message from MySQL 5.0 that I don't understand. > > UPDATE "message_revision" SET "HasData" = 1, "Data" = (SELECT "Data" > FROM "message_revision" WHERE "MessageId" = 7 AND "RevisionNumber" = 5) > WHER