acrocker3434
Registered User.
- Local time
- Yesterday, 16:23
- Joined
- Oct 24, 2007
- Messages
- 13
Hi-
I have two tables: Patients and Office Visits. There is a one to many relationship between the two (one patient has many office visits). At each office visit we collect different data points:
table=visit
MRN
date
height
weight
blood pressure
hem A1c
I have a top values query set up so that I can see each patient's most recent office visit. The SQL view looks like this:
SELECT Patients.MRN, Max(Visits.Date) AS MostRecentVisit, Patients.LastName, Patients.FirstName, Patients.DOB
FROM Patients INNER JOIN Visits ON Patients.MRN = Visits.MRN
GROUP BY Patients.MRN, Patients.LastName, Patients.FirstName, Patients.DOB;
Now, I want to be able to see the height, weight, and hem A1c associated with that visit BUT when I add these fields to the query I get ALL of them, not just the one associated with the most recent visit.
Any thoughts???
THANK YOU
I have two tables: Patients and Office Visits. There is a one to many relationship between the two (one patient has many office visits). At each office visit we collect different data points:
table=visit
MRN
date
height
weight
blood pressure
hem A1c
I have a top values query set up so that I can see each patient's most recent office visit. The SQL view looks like this:
SELECT Patients.MRN, Max(Visits.Date) AS MostRecentVisit, Patients.LastName, Patients.FirstName, Patients.DOB
FROM Patients INNER JOIN Visits ON Patients.MRN = Visits.MRN
GROUP BY Patients.MRN, Patients.LastName, Patients.FirstName, Patients.DOB;
Now, I want to be able to see the height, weight, and hem A1c associated with that visit BUT when I add these fields to the query I get ALL of them, not just the one associated with the most recent visit.
Any thoughts???
THANK YOU