0

I have two Tables in SQL:

Table 1                        Table 2
A B C                          A B C
0 2 3                          1 3 5  
3 4 5                          4 6 7 
1 6 8                          3 4 5

I want to "merge" them. The result should look like this.

Table Result
A B C
0 2 3
3 4 5
1 6 8
1 3 5
4 6 7

So I just want to take over the rows in Table 2 which are not in Table 1. I dont want the rows in Table 2 which are already in Table 1. As you can see the name of the columns are also the same.

  • Seem like you're looking for `UNION`. What is your expected result if table1 has 3 duplicated rows, table2 has 5 duplicated rows that's the same as in table1? – Pham X. Bach Aug 14 '19 at 07:40

2 Answers2

0

You can use union all

select * from Table1
Union all
select * from Table2
Red Devil
  • 2,343
  • 2
  • 21
  • 41
0
select * from Table1
Union
select * from Table2

If you want to Insert into new Table Then

Select * 
INTO Table3
FROM
(select * from Table1
Union
select * from Table2)
KDM
  • 144
  • 8