filtering for unique items in a field

G

Gringarlow

I have a query with several fields. I want to be able to filter a specific
field for unique values.
Let me explain :
Field Name : Circuit ID
Field Name : Install Date
Field Name : Repair Date
Field Name : W-10
Circuit ID and Install Date come from the Install Table.
Repair Date comes from the Repair Table. W-10 is created in the query.

A circuit is installed on a specific date. If it goes into trouble a
repairman is snet out and fixes it on a specific date other than the install
date. If the repair date is within 10 days of the install date field W-10 is
flagged with a Y.
If, the same circuit goes into trouble again within 10 days of the install a
new record is created in the query. I only want to show the earliest trouble
record in this query, I need to classify the second repair differently.
 
D

Dale Fye

How about something like:

Select [Circuit ID], [Install Date], Min([Repair Date]),
IIF(DateDiff("d", [Install Date], Min([Repair Date])) < 10, "Y",
"N") as [W-10]
FROM yourTable
GROUP BY [Circuit ID], [Install Date]

HTH
Dale
 

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