Skip to content
Advertisement

How can I merge two SQL tables and then append the result to a third?

Say I have the following three tables:

Table 1

Table 2

Table 3

What is the most efficient way using SQL to merge Tables 1 and 2 together and append the result to Table 3 in order to get the following result (but leave 1 and 2 as they are)?

Table 3 after operation

Advertisement

Answer

Just insert a cross join between the 2.
But don’t insert those that already exist in table 3.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement