Making a Query compare entries in seperate tables

  • Thread starter Thread starter Scott Crews
  • Start date Start date
S

Scott Crews

I need to make a query that will look at two tables (one
field in each of the two tables) and pull up all the
entries that are in the first table, but not the second
one. Here are more details:

The first table is called "Sponsor", and the field
is "Sponsor Number"

The second table is called "Child Sponsor Matchup" and the
field is called "Sponsor Number" also. Both are Numeric
Fields.

I need the query to display all the entries from "Sponsor"
who do not appear in "Child Sponsor Matchup", based on
comparing the sponsor numbers. Any ideas?

Thanks

Scott
 
SELECT * FROM Sponsor WHERE [Sponsor Number] NOT IN (SELECT
DISTINCT [Sponsor Number] FROM [Child Sponsor MatchUp])

Hope This Helps
Gerald Stanley MCSD
 
Scott said:
I need to make a query that will look at two tables (one
field in each of the two tables) and pull up all the
entries that are in the first table, but not the second
one. Here are more details:

The first table is called "Sponsor", and the field
is "Sponsor Number"

The second table is called "Child Sponsor Matchup" and the
field is called "Sponsor Number" also. Both are Numeric
Fields.

I need the query to display all the entries from "Sponsor"
who do not appear in "Child Sponsor Matchup", based on
comparing the sponsor numbers. Any ideas?

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

Classic LEFT JOIN situation:

SELECT S.[Sponsor Number]
FROM Sponsor As S LEFT JOIN [Child Sponsor Matchup] As C
ON S.[Sponsor Number] = C.[Sponsor Number]
WHERE C.[Sponsor Number] Is Null


- --
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

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

iQA/AwUBQGCBkoechKqOuFEgEQK6VgCfX5sGkkykteBiysSLRj1PoyWG7WsAnAod
74P4r43mOwg89KJd6jmnSqYC
=QNAV
-----END PGP SIGNATURE-----
 
Perfect! Thanks so much!

-----Original Message-----
SELECT * FROM Sponsor WHERE [Sponsor Number] NOT IN (SELECT
DISTINCT [Sponsor Number] FROM [Child Sponsor MatchUp])

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
I need to make a query that will look at two tables (one
field in each of the two tables) and pull up all the
entries that are in the first table, but not the second
one. Here are more details:

The first table is called "Sponsor", and the field
is "Sponsor Number"

The second table is called "Child Sponsor Matchup" and the
field is called "Sponsor Number" also. Both are Numeric
Fields.

I need the query to display all the entries from "Sponsor"
who do not appear in "Child Sponsor Matchup", based on
comparing the sponsor numbers. Any ideas?

Thanks

Scott
.
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top