I'm using the blow query to update a column in multiple rows:
UPDATE table SET col =
(case
when id = 1 then 10
when id = 2 then 20
when id = 3 then 30
end)
And I know if I want to increase the col
value I should do this:
UPDATE table SET col = col+10
But it doesn't work for updating multiple rows.
I also tried:
when id = 1 then (@col := @col + 10)
But this doesn't work too.
Anyone knows how can I concatenate these two with each other and increase one column's value in multiple rows in mysql ?