Retrieve a list outside the subset list

  • Thread starter Thread starter Warren
  • Start date Start date
W

Warren

I have two tables. Both are identical with one column called CompanyID.
Table A's data is a subset of Table B. I want to query all CompanyIDs in
Table B that are not in Table A.

I don't really understand the various Joins. Greatly appreciate any
direction here.
-Warren
 
Warren said:
I have two tables. Both are identical with one column called CompanyID.
Table A's data is a subset of Table B. I want to query all CompanyIDs in
Table B that are not in Table A.

I don't really understand the various Joins. Greatly appreciate any
direction here.
-Warren

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

Classic LEFT JOIN solution:

SELECT B.CompanyID
FROM TableB As B LEFT JOIN TableA As A ON B.CompanyID = A.CompnayID
WHERE A.CompanyID IS NULL

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

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

iQA/AwUBR5CbC4echKqOuFEgEQIFqgCbBS1qX5YF24gIJPahR/hMsbk31X4AnjIZ
yMuuB13WmManhGs8Li1lez4y
=fiZq
-----END PGP SIGNATURE-----
 
There is a query wizard that will build this query for you. It is the
unmatched query wizard and is available when you click New query in the
database window.

--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
Back
Top