I am an Access Beginner,
I have a medications database based on 3 tables...tblPatients, tblPatientMedications and tblMedications. I can query for patients using a single medication.
I need to query for patients who use:
1. both MedA AND MedB
2. both MedA AND MedB but NOT MedC
3.MedA OR MedB but NOT MedC
I've been trying...
SELECT DISTINCT tblPatients.FirstName, tblPatients.LastName, tblPatients.City
FROM tblPatients INNER JOIN (tblMedications INNER JOIN tblPatientMedications ON tblMedications.Med_ID = tblPatientMedications.Med_ID) ON tblPatients.Patient_ID = tblPatientMedications.Patient_ID
WHERE (((tblMedications.MedName)="Lantus" And (tblMedications.MedName)="Januvia"))
ORDER BY tblPatients.City;
I would like to end up with a parameter query that staff could fill
Thanks for your help
I have a medications database based on 3 tables...tblPatients, tblPatientMedications and tblMedications. I can query for patients using a single medication.
I need to query for patients who use:
1. both MedA AND MedB
2. both MedA AND MedB but NOT MedC
3.MedA OR MedB but NOT MedC
I've been trying...
SELECT DISTINCT tblPatients.FirstName, tblPatients.LastName, tblPatients.City
FROM tblPatients INNER JOIN (tblMedications INNER JOIN tblPatientMedications ON tblMedications.Med_ID = tblPatientMedications.Med_ID) ON tblPatients.Patient_ID = tblPatientMedications.Patient_ID
WHERE (((tblMedications.MedName)="Lantus" And (tblMedications.MedName)="Januvia"))
ORDER BY tblPatients.City;
I would like to end up with a parameter query that staff could fill
Thanks for your help
Last edited: