How to merge two tables with repeated primary keys?

0

I have two tables that we need to unify in one, in a complete way: Consider everything in the first, see if it hits the second and what does not beat or repeat, include in the end lines.

Note that key 2 is replayed in the second table, so a procv would not resolve in case of 2 or more occurrences. Key 5 has no impact on the first table. In these cases, they were entered at the end of the third table.

Here's an example:

	Tabela 1									
										
A	B	C	D	E	F					
1	Brasil	Carro	Honda	Fit	100					
2	Chile	Carro	Honda	CRV	200					
3	Russia	Moto	yamaha	Crosser	150					
4	Russia	Carro	Volvo	v40	300					
										
	Tabela 2									
										
U	V	X	Y	W	Z					
1	Brasil	P	-	-	100					
2	Chile	-	4rodas	-	100					
2	Uruguai	G	4rodas	-	100					
5	EUA	G	8rodas	Transporte	400					
										
	Tabela 3 unificada
							
A	B	C	D	E	F	V	X	Y	W	Z
1	Brasil	Carro	Honda	Fit	100	Brasil	P	-	-	100
2	Chile	Carro	Honda	CRV	200	Chile	-	4rodas	-	100
3	Russia	Moto	yamaha	Crosser	150					
4	Russia	Carro	Volvo	v40	300					
5	EUA					EUA	G	8rodas	Transporte	400
2						Uruguai	G	4rodas	-	100

Could you help me?

    
asked by anonymous 11.01.2018 / 12:04

0 answers