1

we have 2 table . we want to transfer table_1 data to table_2 with out duplicate data.

Table_1
----------
1

2

3

4
----------

Table_2
----------
2

4
----------

now we want to transfer Table_1 Values to Table_2 without duplicate. please tell me how to do in mysql query

1

2 Answers 2

3
insert into table_2 
select * 
  from table_1 
 where column not in (select column from table_2);
Sign up to request clarification or add additional context in comments.

Comments

2

First create unique index on the column (you want to keep unique) in table_2.

Now use below statement-

insert ignore into table_2 select * from table_1;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.