Copy row but with new id

后端 未结 6 1031
有刺的猬
有刺的猬 2020-12-07 22:36

I have a table \"test\" with an auto incremented id and an arbitrary number of columns.

I want to make a copy of a row in this table with all columns th

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-07 22:52

    This works in MySQL all versions and Amazon RDS Aurora:

    INSERT INTO my_table SELECT 0,tmp.* FROM tmp;
    

    or

    Setting the index column to NULL and then doing the INSERT.

    But not in MariaDB, I tested version 10.

提交回复
热议问题