Getting First/Last Values from a query

annemu

Registered User.
Local time
Today, 23:44
Joined
Nov 10, 2008
Messages
16
I have a table of data that lists a patient's name, Medical record Number, Admission Date, Laboratory Haemoglobin Value, and the time the test was taken.
I want to limit the resuilts in the query to show only the patient's first Laboratory HB (haemoglobin) value, but I cannot get the query to work. It keeps outputting very strange results and I cannot figure out how to do it.
There are 1600 records within this table for approx. 192 patients. Any ideas?
 

Attachments

  • AccessQuery.JPG
    AccessQuery.JPG
    67.8 KB · Views: 135
Anne there has been many discussions on the forum regarding the use of first and last but the experts conclusion is don't use them. I wont go into it now a search on First and Pat Hartman as user will point you at the info.

Now your problem, I think that you will need 3 queries
1 Groupby the first 2 fields of the current query and Min on Date this gives the earliest date
2 join this to the 2nd table and min on time to get earliest time
3 join this back to table on time + other fields as needed to then get the HB level. Run this query

Brian
 
Cheers Brian,

I did what you suggested - it is a logical answer when you see the end result - just couldn't see the wood for the trees!

First time using this forum - delighted with the result!

Anne
 

Users who are viewing this thread

Back
Top Bottom