6
My situation is as follows: I have several tables that have some common information, 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 it exists, display the information of this other table.
Ex:
Table
unid - info
100 - 20
101 - 15
102 - 40
103 - 35
Table
Unid - info
101 - 25
103 - 40
what I wish to display:
100 - 20
101 - 25
102 - 40
103 - 40
All searches the units will be individual, I will be consulting only 1 unit at a time, then consulted unit 103, need only information 40.
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
Felipe, what have you researched so far? Read [Ask] and [tour] and reflect if your question is okay.
– gmsantos
Friend... if any answer helped you, mark "accept" in the best answer and vote for all that helped you. So you make sure that whoever wrote the answer gets something in return, in addition to making the site cleaner and more useful for everyone.
– LucasMotta