Reputation: 136
I have a DB setup with two columns, ID
and VAL
.
ID
is an incrementing integer, starting from 1 and increasing by 1 for each row. VAL
is a simple string.
How can I update each row's ID
to be 10 times greater? E.g.:
ID 1, 2, 3
-> ID 10, 20, 30
Or is there a better method to adding a trailing zero to the end of every row in a column?
Upvotes: 0
Views: 181
Reputation: 98388
If you are trying to update the existing values, you simply need to do:
update mysterytablename set ID=ID*10 order by ID desc;
(The order by is only needed if ID is a primary or unique key, which presumably it is.)
Upvotes: 1