How to make the following statement to work in MySQL?
UPDATE my_table t1 SET column_1 =
(SELECT column_1 FROM my_table t2 WHERE t2.id = (t1.id - 1))
WHERE t1.type = 2
I am getting a "You can't specify target table 't1' for update in FROM clause" error.
You can update with a join: