I have 2 tables which have names and emails. Now I want to merge these tables into a new table without duplicate records. I want to use email fields for avoiding duplicate values in both tables. I heard INSERT IGNORE query is using for inserting values into a table without affecting existing records. How to write INSERT IGNORE query to check email field for duplication checking. If anyone knows other methods are also welcome.
table1:
fid fname email
--- ----- -----
1 Balaji [email protected]
2 xxxxx [email protected]
3 Bala [email protected]
table2:
gid gname gemail
--- ----- ------
1 Bala [email protected]
2 vinoth [email protected]
Expected result:
table3:
-------
id name email
-- ---- -----
1 Balaji [email protected]
2 xxxxx [email protected]
3 Bala [email protected]
4 vinoth [email protected]