Consulta con Left Join

19/11/2003 - 01:16 por Fernando | Informe spam
Tengo una tabla1 con un atributo cod1 (string) y otra tabla2 con cod2
(string), clave (string) y codprov (int). Yo quiero tomar todos los
registros que estan en tabla2 y no estan tabla1 pero que clave <> '' y
codproc = 10.

Hice 2 consultas que parecen iguales pero me arrojan resultados distintos
????

Select * from tabla1
where cod2 not in (Select cod1 from tabla1) and
clave <> '' and codproc = 10

Select t2.cod2, t2.clave, t2.codprov
from tabla2 t2
LEFT JOIN tabla1 t1 ON t1.cod1 = t2.cod2
where t2.clave <> '' and t2.codproc = 10

Alguien puede ver la diferencia.

Gracias de antemano
Saludos
Fernando

Preguntas similare

Leer las respuestas

#6 Fernando
20/11/2003 - 02:37 | Informe spam
Muchas gracias a todos, ahora he notado bien la diferenca.
Saludos
Fernando

"Diego Buendia" escribió en el mensaje
news:
Mostrar la cita
news:...
Mostrar la cita
que
Mostrar la cita
mientras
Mostrar la cita
Ads by Google
Search Busqueda sugerida