Reputation: 14711
lets say I have the following table
players
player_id score
1 - 300
2 - 400
can I do a query that will add 10 to the score of a player?
because right now all I can think of is query the db, get the score, add 10 to it, then query the db and replace 300 with 310?
PS: Im new to SQL
Upvotes: 2
Views: 56
Reputation: 172458
You may try this:-
UPDATE players
SET score = score + 10
WHERE player_id = 1
Also check UPDATE in MySQL
Upvotes: 3