Fórum Algo como IN com parametros multiplos #57071
12/10/2006
0
Quero mostrar o apenas os registros que existam em um OUTRO select.
ex:
select y,z,x
from [b:5378fc6716]tab1[/b:5378fc6716]
where
y=a and
z=b and
x=c
--Comparação feita em cada [b:5378fc6716]resultado[/b:5378fc6716] do select em tab2
(
select a,b,c
from tab2
--É importante que mantenha este select totalmente independente do select em tab1. Neste select eu posso por qualquer coisa.
)
-[b:5378fc6716]O IN serve por trabalhar apenas com um parametro(<val> IN ....) eu quero a mesma coisa, so que com mais de um.[/b:5378fc6716]
(<val>,<val>,<val>,<val>) IN ............
Como fazer isso?
Me ajudem.
ex:
select y,z,x
from [b:5378fc6716]tab1[/b:5378fc6716]
where
y=a and
z=b and
x=c
--Comparação feita em cada [b:5378fc6716]resultado[/b:5378fc6716] do select em tab2
(
select a,b,c
from tab2
--É importante que mantenha este select totalmente independente do select em tab1. Neste select eu posso por qualquer coisa.
)
-[b:5378fc6716]O IN serve por trabalhar apenas com um parametro(<val> IN ....) eu quero a mesma coisa, so que com mais de um.[/b:5378fc6716]
(<val>,<val>,<val>,<val>) IN ............
Como fazer isso?
Me ajudem.
Lorde_morte.
Curtir tópico
+ 0
Responder
Posts
23/10/2006
Emerson Nascimento
algo assim não resolveria?
select
tab1.y, tab1.z, tab1.x
from
tab1
inner join
tab2 on (tab2.a = tab1.y and tab2.b = tab1.z and tab2.c = tab1.x)
select
tab1.y, tab1.z, tab1.x
from
tab1
inner join
tab2 on (tab2.a = tab1.y and tab2.b = tab1.z and tab2.c = tab1.x)
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)