Updating an “order” column MySQL?

前端 未结 2 1812
面向向阳花
面向向阳花 2021-01-22 00:45

What\'s the best way to update an \"order\" column?

Say I have an id column with 0 to 9, and order column from 0 to 9.

Currently, it\'s in the database as: 0 0,

2条回答
  •  半阙折子戏
    2021-01-22 01:26

    You have to update each row by itself, there is no way to do a "map" update in sql.

    (There are some tricks but they don't really apply/help here anyway.)

提交回复
热议问题