SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 UPDATE where WHERE is based on SELECT
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Fabricio
Starting Member

South Africa
3 Posts

Posted - 12/09/2013 :  05:42:03  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

Germany
8765 Posts

Posted - 12/09/2013 :  05:48:50  Show Profile  Visit webfred's Homepage  Reply with Quote
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

South Africa
3 Posts

Posted - 12/09/2013 :  06:08:05  Show Profile  Reply with Quote
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

India
52325 Posts

Posted - 12/09/2013 :  06:11:52  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000