Assume that we have two tables in two databases which are located in different database servers.
The situation is this:
Step 1: Select data from the first table.
Step 2: Iterating over the result of the first step
Step 2.1: For each row that is not present in the socond table
Step 2.2: If the result of step 2.1 is true, insert the row to the second table.
In case the tables are in same server the following SQL query works fine:
INSERT INTO server.table2(id, name, adresse) SELECT * FROM server.table1 WHERE table2.id NOT IN (SELECT id FROM server.table2) But I have a problem when the source table and destination table are distributed in two different database servers.
How can I realize the above described steps?