Posted by Ed Murphy on 04/03/07 05:26
David Méndez wrote:
> I need to find the members that exists on the following select queries (not
> union):
>
> SELECT DISTINCT CLIREAL FROM VENTAS WHERE CLIREAL NOT IN (SELECT CODE FROM
> CLIENTES)
> SELECT DISTINCT CLIREAL FROM VENTAS WHERE CLIREAL NOT IN (SELECT CODE FROM
> CLIENTCONV)
>
> Basically I need to choose the rows VENTAS.CLIREAL that do not exists in
> CLIENTES.CODE rows and that also do not exists in the CLIENTCONV.CODE rows.
select distinct clireal
from ventas
where clireal not in (select code from clientes)
and clireal not in (select code from clientconv)
Alternatively:
select distinct clireal
from ventas
where clireal not in (select code from clientes
union select code from clientconv)
[Back to original message]
|