Autoincrement manually a column MySQL

后端 未结 2 1348
余生分开走
余生分开走 2021-01-27 14:52

I have a table with columns:

[id,name,public_id]

actually the table contains

[1,john,0]
[2,sara,0]
[3,jack,0]
.....
         


        
2条回答
  •  日久生厌
    2021-01-27 15:27

    You can do an update like this:

    UPDATE table SET public_id = id + 1049
    

    With this, you are using the ID, and adding 1049 to it to get the result you need

提交回复
热议问题