By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,777 Members | 1,311 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,777 IT Pros & Developers. It's quick & easy.

update query with select query

P: 1
hello there;

im trying to use the following piece of code but it doest work,

UPDATE itermdesc SET qnty = ( SELECT qnty -1
FROM itermdesc
WHERE itermcode =1001 )
WHERE itermcode =1001

it display the following error

You can't specify target table 'itermdesc' for update in FROM clause

Any quick help would be much appreciated!
Jan 15 '12 #1
Share this Question
Share on Google+
1 Reply

P: 144
try something like: UPDATE itermdesc SET qnty = (qnty -1)
WHERE itermcode =1001.

get rid of the statement inside the statement.
Jan 15 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.