'MySQL query to increment of 10.000 the values of a column
I need to increment every value of a column in my table of +10.000
For example, at the moment I have a column like that:
hits
- 12
- 1443
- 876
- 345
- 34
- and so on...
I would increase every value + 10.000 so it becomes
- 10.012
- 11.443
- and so on...
What's the correct SQL query I should use?
Solution 1:[1]
Just a simple Googling can give you answer to this question.Anyway You can use Update query to achieve above scenario.Like
Update yourtable set yourcolumn=yourcolumn + 10000 where somecondition
And if you are learning Mysql ,you can use Mysql Tutorial for further References
Solution 2:[2]
UPDATE your_table
SET your_column = your_column + 10000
Solution 3:[3]
Before add you need to divide your column value like (1443/1000)+10.000 this :-
Update yourtable set yourcolumn=(yourcolumn/1000)+10.000
where somecondition
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | akhil kumar |
| Solution 2 | Vatev |
| Solution 3 | Abhishek Sharma |
