Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to leave the biggest date range within a certain date range

Status
Not open for further replies.

iren

Technical User
Mar 8, 2005
106
US
Hi everyone!

I have a multiple admission records for the same members. I need to delete those records for the same member whose discharge date minus Admit_dt is the biggest within the time range and to leave just those ones whose (disch-adm_dt) date range within a certain date range is bigger for the dame admID and facility. Also all full duplicates should be eliminated
For example:
Fil has five records

admId name facility adm-dt disch
111 Fil A 12/18/2002 1/7/2003
111 Fil B 12/18/2002 1/2/2003
111 Fil B 12/18/2002 1/7/2003
111 Fil B 12/18/2002 1/4/2003
111 Fil B 12/18/2002 1/7/2003


the output should look:

admId name facility adm-dt disch
111 Fil A 12/18/2002 1/7/2003
111 Fil B 12/18/2002 1/7/2003


How can I implement it in Access query?

Thank you in advance!

Iren

 


Hi,

Use the MAX function on disch and Group on the others.

Skip,

[glasses] [red][/red]
[tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top