N
Ngan
I have a table called tblElig with the fields: EligID,
ClientID, EligDate, EligStatus.
A client can have a history of eligibility interviews and
they would be stored in this table. For us, we want to
see their most current eligibility. Therefore, we should
look at the Elig record of the ClientID where the EligDate
is the max. I want the current EligStatus to be displayed.
If I use a select query using aggregate (totals) function
and include the EligStatus, it will show all the records
for that client, not just the max. Here's my example:
Select ClientID, EligStatus, Max(EligDate) as MaxEligDate
From tblElig Group By ClientID, EligStatus Order by
ClientID, Max(EligDate) DESC
It would give me:
ClientID EligStatus MaxEligDate
100001 U 6/14/04
100001 I 6/1/04
100001 X 6/1/04
If I take out the EligStatus, then I would get the max
record, but it's useless since I want the EligStatus info.
Anyone have a clue to how to get the max record? I just
want the 100001, U, 6/14/04 record to be displayed.
Thanks.
Ngan
ClientID, EligDate, EligStatus.
A client can have a history of eligibility interviews and
they would be stored in this table. For us, we want to
see their most current eligibility. Therefore, we should
look at the Elig record of the ClientID where the EligDate
is the max. I want the current EligStatus to be displayed.
If I use a select query using aggregate (totals) function
and include the EligStatus, it will show all the records
for that client, not just the max. Here's my example:
Select ClientID, EligStatus, Max(EligDate) as MaxEligDate
From tblElig Group By ClientID, EligStatus Order by
ClientID, Max(EligDate) DESC
It would give me:
ClientID EligStatus MaxEligDate
100001 U 6/14/04
100001 I 6/1/04
100001 X 6/1/04
If I take out the EligStatus, then I would get the max
record, but it's useless since I want the EligStatus info.
Anyone have a clue to how to get the max record? I just
want the 100001, U, 6/14/04 record to be displayed.
Thanks.
Ngan