Reputation: 1094
I want to update 2 rows values using Mysql query but sum of previous value and add with new value but problem is that the query which return is throwing error so how to do this?
10 //assume I want to update with value 10
for example balance column should get updated with sum of previous value and new values like 68+10=78 and 70+10=80 based on sessid ,but query which I have return is not working.
UPDATE `users` SET `balance` = 10+(balance) WHERE sessid IN(11,3);
Upvotes: 2
Views: 654
Reputation: 1094
Finally i solved my issue actually query should be like this
UPDATE `users` SET `balance` = balance+10 WHERE sessid IN(11,3);
Upvotes: 4