I have a database that I am using to record some basic patient information.
The tables I have include:
- PatientDB [main table - primary key is Patient_UID].
- Locations [holds names of different locations in a hospital linked to PatientDB by its primary key Location_UID].
- Analgesia_Prima ry [holds names of pain relieving methods, linked to PatientDB by its primary key Analgesia_UID] - there are 2 other similar tables that record different classes of pain relief in the same way using primary key link.
- DailyAssessment [this table has a many-to-one relationship with PatientDB]
The DailyAssessment table has its own primary key, Assessment_UID to record individual assessments for each patient, and links to PatientDB table using an integer value which is the same as Patient_UID.
What I am trying to do is get a query which will produce (for a report):
All patient details that are active (using criteria PatientDB.Activ e=True), the names of the different pain relief options they are on from other tables, and just the most recent entry for that patient from DailyAssessment (I have been using the max value).
I cannot seem to get everything I want from one query and have experimented with sub-queries but do not seem to get anywhere, and often end up with about 60 records being returned even though I do not have that many patients!
Any suggestions would be appreciated, and I can provide more field names etc as needed.
I am using Access 2007.
The tables I have include:
- PatientDB [main table - primary key is Patient_UID].
- Locations [holds names of different locations in a hospital linked to PatientDB by its primary key Location_UID].
- Analgesia_Prima ry [holds names of pain relieving methods, linked to PatientDB by its primary key Analgesia_UID] - there are 2 other similar tables that record different classes of pain relief in the same way using primary key link.
- DailyAssessment [this table has a many-to-one relationship with PatientDB]
The DailyAssessment table has its own primary key, Assessment_UID to record individual assessments for each patient, and links to PatientDB table using an integer value which is the same as Patient_UID.
What I am trying to do is get a query which will produce (for a report):
All patient details that are active (using criteria PatientDB.Activ e=True), the names of the different pain relief options they are on from other tables, and just the most recent entry for that patient from DailyAssessment (I have been using the max value).
I cannot seem to get everything I want from one query and have experimented with sub-queries but do not seem to get anywhere, and often end up with about 60 records being returned even though I do not have that many patients!
Any suggestions would be appreciated, and I can provide more field names etc as needed.
I am using Access 2007.
Comment