My situation is this: I have several tables that have some information in common, such as UNIT.
In one of these tables I have all my units and I need to check if this same UNIT also exists in another table, and if there is, display the information in this other table.
Ex:
Table_A
unid - info
100 - 20
101 - 15
102 - 40
103 - 35
Table_B
Unid - info
101 - 25
103 - 40
What I want to display:
100 - 20
101 - 25
102 - 40
103 - 40
All the searches will be individual, I will be consulting only 1 unit at a time, then I consulted unit 103, I need only 40 information.
EDIT:
Current Code:
Select cgc,
unidade,
MAX(velocidade) as vel ,
circuito,
Rot,
ip_wan,
ip_lan,
loopback0,
loopback21,
loopback22
From circuitos_rede_2
Where cgc=457 Not Exists (Select cgc From circuitos_permanentes )
Union
Select cgc,
unidade,
veloc
From circuitos_permanentes