SQL Server - Add number using subquery and update it in the same table.

Asked By Priyanka on 26-Jun-13 12:26 PM
String sql = "UPDATE table1 SET charges=(select charges+20 from table1 where cust_id=1001) where cust_id=1001";
I am using query like above to update 20 more in charges where id = 1001. But it is giving error "Operation must use an updateable query." Is there anything wrong in my query.
Robbe Morris replied to Priyanka on 26-Jun-13 12:26 PM
why do you need a subquery?

update table1 set charges = charges + 20 where cust_id - 1001