insert data from one table to another in mysql

后端 未结 10 525
深忆病人
深忆病人 2020-11-29 18:39

i want to read all data from one table and insert some data in to another table. my query is

  INSERT INTO mt_magazine_subscription ( 
      magazine_subscr         


        
10条回答
  •  北海茫月
    2020-11-29 19:36

    INSERT INTO destination_table ( 
          Field_1, 
          Field_2, 
          Field_3) 
    SELECT Field_1, 
          Field_2, 
          Field_3 
          FROM source_table;
    

    BUT this is a BAD MYSQL

    Do this instead:

    1. drop the destination table: DROP DESTINATION_TABLE;
    2. CREATE TABLE DESTINATION_TABLE AS (SELECT * FROM SOURCE_TABLE);

提交回复
热议问题