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
insert into test.t2(name2) select distinct name1 from test.t1 where name1 NOT IN(select name2 from test.t2);
OR
insert into test.t2(name2) select distinct name1 from test.t1 t1 where NOT EXISTS(select name2 from test.t2 t2 where t1.name1=t2.name2);