|
|
View previous topic
::
View next topic
|
Author |
Message |
ramon fincken Site's programmer
 Get a free globally recognized avatar It's free!
Joined: 03 Aug 2007 Posts: 412 Location: A'dam/Diemen, The Netherlands
|
Posted: Thu Apr 26, 2012 8:55 am Post subject: [solution] MySQL #1093 - You can't specify target table for update in FROM clause |
|
|
Having #1093 - You can't specify target table for update in FROM clause problems?
I encountered one today, trying to delete old record in a table based on a select based on a timestamp column in the very same table.
I saw the light when I found this thread:
http://stackoverflow.com/questions/8333...rom-clause
which cheats MySQL by using a temporary table like so ( this is the example from Stack )
Code: | UPDATE giveaways SET winner = '1' WHERE ID =
(
SELECT id FROM
(
SELECT MAX(ID) as id FROM giveaways
) AS tmptable
) |
|
|
Back to top |
|
 |
Google adsense Advertisement
|
Posted: Thu Apr 26, 2012 8:55 am Post subject: [solution] MySQL #1093 - You can't specify target table for update in FROM clause |
|
|
Advertisement
|
|
Back to top |
|
 |
GravityForms Advertisement
|
Posted: Thu Apr 26, 2012 8:55 am Post subject: [solution] MySQL #1093 - You can't specify target table for update in FROM clause |
|
|
Advertisement
 |
|
Back to top |
|
 |
nistelrock
 Get a free globally recognized avatar It's free!
Joined: 26 Apr 2014 Posts: 1
|
Posted: Sat Apr 26, 2014 9:59 am Post subject: Re: [solution] MySQL #1093 - You can't specify target table for update in FROM clause |
|
|
Thanks, it works!
Last edited by nistelrock on Sat Oct 25, 2014 9:03 pm; edited 1 time in total |
|
Back to top |
|
 |
ramon fincken Site's programmer
 Get a free globally recognized avatar It's free!
Joined: 03 Aug 2007 Posts: 412 Location: A'dam/Diemen, The Netherlands
|
Posted: Sat Apr 26, 2014 7:19 pm Post subject: Re: [solution] MySQL #1093 - You can't specify target table for update in FROM clause |
|
|
That's great! I love to help  |
|
Back to top |
|
 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|