Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: distinct with <>
Hello. The easiest way to solve this problem is by using the MINUS
keyword. The MINUS keyword returns rows that are in one table but not
in the other.
Consider both your tables (say, TBLA and TBLB) have the following two columns:
NAME VARCHAR2(255),
EMAIL VARCHAR2(255)
If you want to know who has an e-mail address in TBLA but not in TBLB,
run the following query:
SELECT name
FROM tbla
MINUS
SELECT name
FROM tblb;
I would suggest reading the Oracle documentation on MINUS, UNION, UNION ALL, and INTERSECT. Received on Mon May 09 2005 - 14:40:49 CDT