I have a table that records when clients have entered and exited a program. Clients can enter multiple times, often sequentially:
I am having trouble with a query that would find the first EntryDate and last ExitDate for each client. The optimal results would be like this:
The query needs a "WHERE InProgram = 'N'" clause at the end as well.
Thanks in advance for your help!
Code:
UID ClientID EntryDate ExitDate InProgram
1 5 1/1/2006 1/2/2006 N
2 5 1/2/2006 1/3/2006 N
3 5 1/3/2006 1/4/2006 N
4 5 1/4/2006 1/5/2006 N
5 6 1/2/2006 1/3/2006 N
6 6 1/3/2006 1/4/2006 N
7 7 1/6/2006 1/7/2006 N
I am having trouble with a query that would find the first EntryDate and last ExitDate for each client. The optimal results would be like this:
Code:
ClientID FirstDate LastDate InProgram
5 1/1/2006 1/5/2006 N
6 1/2/2006 1/4/2006 N
7 1/6/2006 1/7/2006 N
The query needs a "WHERE InProgram = 'N'" clause at the end as well.
Thanks in advance for your help!