Reputation: 17
How can i set balance to be balance + 2% (two percent of balance)
I have tried to do the following:
UPDATE users SET balance = balance + 2 '%';
but it didn't work.
Also tried this:
UPDATE users SET balance = balance + 2%;
It still didn't work.
Upvotes: 1
Views: 669
Reputation: 9243
Simply 2% represent 2 of 100%
-- 2% = balance * (2/100)
UPDATE users SET balance = balance + balance * (2/100);
Upvotes: 3