table one ssn, name, branch table two ssn, name, branch the two tables may contain overlapping data. I want to take the cases where ssn = ssn and branch = branch and move it into a Third table. How can I do this?
INSERT INTO ThirdTable (ssn, branch, name) SELECT t1.ssn, t1.branch, t1.name FROM FirstTable t1 INNER JOIN SecondTable t2 ON t1.ssn=t2.ssn AND t1.branch = t2.branch; This would do the insert. But when you say "move", do you mean you also want to physically delete the rows from table1 and table2?