Copy rows from the same table and update the ID column

前端 未结 8 529
情歌与酒
情歌与酒 2021-02-01 02:09

I have the following table

\"alt

I have inserted Product B to it and it gives me an ID of 15

8条回答
  •  青春惊慌失措
    2021-02-01 02:53

    If you want to replicate data in same table use this logic:

    first, insert statment where you want to insert...

    insert into [table](column1,column2)
    

    second, select statment from where you want to take data for insertion....

    select (column1/'your value',column2/'your value') from [table]
    

    now set filter which rows you want to duplicate

    where (your condition)
    

    as want to replicate same data for different customers i have used this query.

提交回复
热议问题