WalkieTalkie
Technical User
I have a table showing date, lab test type, and Lab test results for each patient eg:
I want a query to show me the latest test result for each type of test, for each patient. eg the results I want are:
I am able to make a totals query that shows the max(TestDate) for each PatientID. Likewise I can do another one for max(TestDate) for each TestID, but I can't for the life of me work out how to combine the two so that I get max(TestDate) for each TestID, for each patient. I also need to include the TestResult field. No matter what I do I can't get the right results. I would love someone to show me how!
Thanks in advance
Code:
PatientTestID PatientID TestID TestDate TestResult
1 10 x 15/1/06 105
2 10 y 15/1/06 200
3 15 x 10/10/06 678
4 10 x 13/1/06 209
5 15 y 10/3/06 765
6 15 y 12/3/06 890
7 10 y 17/1/06 23
Code:
PatientTestID PatientID TestID TestDate TestResult
1 10 x 15/1/06 105
3 15 x 10/10/06 678
6 15 y 12/3/06 890
7 10 y 17/1/06 23
Thanks in advance