Catagorizing a person within a duration

naungsai

Abecedarian
Local time
Tomorrow, 02:09
Joined
Sep 8, 2008
Messages
123
Date, Person and Catgory are the field name of my table.

Date Person Catagory
1/20/2008 0001 A
1/25/2008 0002 A
1/30/2008 0003 B
1/30/2008 0001 B
2/10/2008 0002 B
2/15/2008 0002 B
----
----
7/10/2008 0001 A

When we count 6 months backward from today, if a particular person was in catagory A in any time, I want to Catagorize him as "A".
In other words, within 6 month duration, if a person have been catagoize as A sometime, he will be "A" regardless of how many occurance of "B".

How should I do it? Help me please.

Thanks in advance!:)

 
A simple matter of a group by query... Feeling particularly helpfull today.. so here is your SQL

Select Person, min(category)
from YourTable
Where [date] > Dateadd("M", -6, date())
group by Person

Note:
Using access reserved words (like date) as a column is asking for trouble, change the column to be something more meaningfull.
 

Users who are viewing this thread

Back
Top Bottom