Add a number to an unknown number in SQL

Is it possible to add a number to an unknown number in sql column? For example:

My sql database has a column called "totalRating". I want to add +1 to any number stored in this column. Therefore, if number 14 is stored in the totalRating column, +1 will make it equal to 15.

Can this be done without returning this number from sql? Sort of:

UPDATE MyTable SET overallRating+=1 WHERE url='myurl..'

EDIT When a solution has already been set:

Actually I have not tried my code above, but I have done it now, and it also works. I made a syntax error on my first try, so I thought it was not working.

+4
source share
2 answers

+= T-SQL , , PROD , :

UPDATE MyTable SET overallRating=overallRating+1 WHERE ...
+9

userid = (userid + 1), userid = 1

0

All Articles