How to move then delete field in MySQL

后端 未结 1 427
感动是毒
感动是毒 2021-01-29 04:16

I am trying to move a field from one table to another and then delete it from the first table. The problem I am having is that it moves the data fine, but it is not deleting it

相关标签:
1条回答
  • 2021-01-29 04:44

    As I understand you trying to move ALL columns from one table (t1) to another table (t2) with same structure (or to table, that contain same columns like in first) and than you want to delete data from table1 that you moved to t2? If correct use next SQL

    INSERT INTO t2 SELECT * FROM t1;
    DELETE FROM t1 WHERE 1;
    
    0 讨论(0)
提交回复
热议问题