How to insert records from table to another without duplicate

后端 未结 5 1658
小鲜肉
小鲜肉 2021-01-21 17:01

I have two tables t1 and t2. t1 has duplicated values. I need to insert all records from t1 to t2, but I don\'t want duplicates to occur in t2. I tried the following command whi

5条回答
  •  心在旅途
    2021-01-21 17:29

    this should do it:
    INSERT IGNORE INTO test.t2 SELECT name2 FROM test.t1
    Selects from one table and inserts into another.

提交回复
热议问题