dbTalk Databases Forums  

Compliment to Union

comp.database.ms-access comp.database.ms-access


Discuss Compliment to Union in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Chris Koch
 
Posts: n/a

Default Compliment to Union - 07-29-2003 , 11:58 AM






Can anyone tell me how I would run a query to give me a set of members
that are in one set but not in another? In other words, I have
customers in dataset A and customers in dataset B and I want to run a
query that will produce those customers in A but not in B.

Reply With Quote
  #2  
Old   
MGFoster
 
Posts: n/a

Default Re: Compliment to Union - 07-30-2003 , 05:05 AM






-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

You'd use a LEFT JOIN query. E.g.:

SELECT R1.<columns>
FROM <dataset 1> AS R1 LEFT JOIN <dataset 2> AS R2
ON R1.<column> = R2.<column>
WHERE R2.<column> IS NULL

The above query would return all records in dataset 1 (R1) that are
not in dataset 2 (R2). The ON clause <column> would have to be a
column in both datasets that hold the same info (e.g.: social security
numbers). The WHERE clause <column> should be the same as the ON
clause <column>; this will force the query to return only those
records in dataset 1 that are not present in dataset 2.

HTH,

MGFoster:::mgf
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBPyeZtYechKqOuFEgEQLLbACeKwthxpz0aBhtFWzfMjAaPP a2hX8AoOvM
G9pB3h0FDu90fsWGyik+ECwq
=ZTby
-----END PGP SIGNATURE-----


Chris Koch wrote:
Quote:
Can anyone tell me how I would run a query to give me a set of members
that are in one set but not in another? In other words, I have
customers in dataset A and customers in dataset B and I want to run a
query that will produce those customers in A but not in B.


Reply With Quote
  #3  
Old   
Chris Koch
 
Posts: n/a

Default Re: Compliment to Union - 07-30-2003 , 09:01 AM



On Wed, 30 Jul 2003 10:05:10 GMT, MGFoster <mgf00 (AT) earthlink (DOT) net>
wrote:

Thank you. Works like a charm!

Quote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

You'd use a LEFT JOIN query. E.g.:

SELECT R1.<columns
FROM <dataset 1> AS R1 LEFT JOIN <dataset 2> AS R2
ON R1.<column> = R2.<column
WHERE R2.<column> IS NULL

The above query would return all records in dataset 1 (R1) that are
not in dataset 2 (R2). The ON clause <column> would have to be a
column in both datasets that hold the same info (e.g.: social security
numbers). The WHERE clause <column> should be the same as the ON
clause <column>; this will force the query to return only those
records in dataset 1 that are not present in dataset 2.

HTH,

MGFoster:::mgf
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBPyeZtYechKqOuFEgEQLLbACeKwthxpz0aBhtFWzfMjAaPP a2hX8AoOvM
G9pB3h0FDu90fsWGyik+ECwq
=ZTby
-----END PGP SIGNATURE-----


Chris Koch wrote:

Can anyone tell me how I would run a query to give me a set of members
that are in one set but not in another? In other words, I have
customers in dataset A and customers in dataset B and I want to run a
query that will produce those customers in A but not in B.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.