URGENT.... -Finding specific records -

C

Carlee

Hi,
I am struggling. I have two tables that are related without referential
integrity:

tblDevices
Fields: Serial Number, Device Type(network or desktop)

tblPrintActuals
Fields: Serial Number, Count Month, Impression Count

These tables are related, but without ref. integrity. I have done this
because I can get, via data dump, impression data for printers that are not
in the devices table. I want to know about these devices.

Issue:
I want to identify all network devices that did not have impression counts
this month or last month. These devices may have had impressions in the
past, but not for the two month period in question.

I can get the following information:

Network devices that had an impression count listed in print actuals this
month, but not last

Network devices that had an impression count listed in print actuals last
month, but not this month

Any help would be extemely appreciated.
 
A

Allen Browne

Use a subquery such as this:

SELECT tblDevices.*
FROM tblDevices
WHERE NOT EXISTS
(SELECT [Impression Count]
FROM tblPrintActuals
WHERE tblPrintActuals.[Serial Number] = tblDevices.[Serial Number]
AND tblPrintActuals.[Count Month] IN (1,2));

I'm not clear what numbers you would need to use to match "this month and
last month" in your Count Month field.

If subqueries are new, see:
How to Create and Use Subqueries
at:
http://support.microsoft.com/?id=209066
 

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

Top