1

In Mssql i want to update a column col1 in table named Table1 using select query which returns col1 from Table1 and add 1 to it. So i used the following code

update Table1 set col1=(select col1 from Table1) + 1;

But when i used it says you cannot target same table.Is there any ways to work out this function. Please help to find it out.

Thanks in advsnce

0

1 Answer 1

2

you can do it like that

     update Table1 set col1= col1 + 1;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.