dusanv
Programmer
- May 29, 2002
- 20
- 0
- 0
Consider the following table:
SSN Record Name Member EffDate ENREFFDT
123456789 GCRDEVNT WORK 6/6/2002 20020603
123456789 GCRDEVNT WORK 6/8/2002 20020608
555555555 GCRDEVNT WORK 5/8/2002 20020603
555555555 GCRDEVNT WORK 6/3/2002 20020608
I want to have a query that will output only records with the most recent EffDate, like this:
SSN Record Name Member EffDate ENREFFDT
123456789 GCRDEVNT WORK 6/8/2002 20020608
555555555 GCRDEVNT WORK 6/3/2002 20020608
I've read several older threads on how to do this and the common suggestion was to use the MAX function on the date field and it works well. However, now I need to make my query more sophisticated so that I can specify a date range with query returning a top dated record in that range.
Any way to acomplish this? Simply using MAX doesn't work -- what I'm finding is that if I specify <#6/8/2002# for EffDate criteria, no record will be returned for 123456789 SSN above! It looks like MAX function is performed first and only then the filtering.
As always, any suggestions appreciated.
Dusan
SSN Record Name Member EffDate ENREFFDT
123456789 GCRDEVNT WORK 6/6/2002 20020603
123456789 GCRDEVNT WORK 6/8/2002 20020608
555555555 GCRDEVNT WORK 5/8/2002 20020603
555555555 GCRDEVNT WORK 6/3/2002 20020608
I want to have a query that will output only records with the most recent EffDate, like this:
SSN Record Name Member EffDate ENREFFDT
123456789 GCRDEVNT WORK 6/8/2002 20020608
555555555 GCRDEVNT WORK 6/3/2002 20020608
I've read several older threads on how to do this and the common suggestion was to use the MAX function on the date field and it works well. However, now I need to make my query more sophisticated so that I can specify a date range with query returning a top dated record in that range.
Any way to acomplish this? Simply using MAX doesn't work -- what I'm finding is that if I specify <#6/8/2002# for EffDate criteria, no record will be returned for 123456789 SSN above! It looks like MAX function is performed first and only then the filtering.
As always, any suggestions appreciated.
Dusan