Select, Modify and insert into the same table

后端 未结 3 1252
轻奢々
轻奢々 2020-12-30 00:58

What\'s the easiest way to select a row, modify couple of columns and insert it to the same table? I\'m trying to insert a new row based on another.

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-30 01:32

    Say column is int

    INSERT INTO table(column1,column2) SELECT column1 + 1, column2 -1 FROM table
    

    You can multiply columns and perform string functions.

提交回复
热议问题