I have two tables A and B (with the same schema), and I want to merge them by inserting all entries from A into B. If table B already has data associated with a key from A, I want to silently drop those data.
The problem is that table B has a unique key index that consists of three columns, so I can't just say "WHERE A.key <> B.key
".
I can't seem to formulate an SQL statement along the lines of:
INSERT INTO B
VALUES ((SELECT * FROM A WHERE ... NOT IN ...))
Is there a way to INSERT
those rows from A into B where the corresponding three-column-key doesn't exist in B yet?