Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 UPDATE where WHERE is based on SELECT

Author  Topic 

Fabricio
Starting Member

3 Posts

Posted - 2013-12-09 : 05:42:03
I am trying to execute the following query:

UPDATE table1 SET column1 = NULL WHERE column1 = (SELECT column1 FROM table1 WHERE id = @id)

on MySQL server but I get the follwing error message:

"Error Code: 1093. You can't specify target table 'table1' for update in FROM clause"

This works in Microsoft SQL Server. Any ideas on how to get it to work on MySQL?

Thanks

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2013-12-09 : 05:48:50
Here we are on MS SQL Server only.
Maybe you can get the best answer in a MySQL forum


Too old to Rock'n'Roll too young to die.
Go to Top of Page

Fabricio
Starting Member

3 Posts

Posted - 2013-12-09 : 06:08:05
Oops! I'm sorry - I didn't know that. Ok I will try the MySQL forums. Thank you
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-12-09 : 06:11:52
quote:
Originally posted by Fabricio

Oops! I'm sorry - I didn't know that. Ok I will try the MySQL forums. Thank you


there's one at www.dbforums.com FYI

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -