simon4amiee
Registered User.
- Local time
- Today, 22:45
- Joined
- Jan 3, 2007
- Messages
- 109
Hi guys,
The code below bring back the results I want however.....
SELECT dbo_MF_PATIENT.Forename,
dbo_MF_PATIENT.Surname,
dbo_MF_PATIENT.DOB,
dbo_MF_PATIENT.Postcode,
Count(dbo_MF_PATIENT.HEYNo) AS CountOfHEYNo
FROM dbo_MF_PATIENT
GROUP BY dbo_MF_PATIENT.Forename,
dbo_MF_PATIENT.Surname,
dbo_MF_PATIENT.DOB,
dbo_MF_PATIENT.Postcode
HAVING (((Count(dbo_MF_PATIENT.HEYNo)) > 1));
My issue is I want to run this bit of code but only if the dbo_MF_PATIENT.MFPatientID appears in any of the 3 tables below:
dbo_ED_ATTENDANCE, db
P_APPOINTMENT, dbo_IP_ADMISSION
Suppose im unsure on the joining because there is only ever one patient in the dbo_MF_PATIENT table but they could appear dozens of times in any of the other 3 tables.
The code below bring back the results I want however.....
SELECT dbo_MF_PATIENT.Forename,
dbo_MF_PATIENT.Surname,
dbo_MF_PATIENT.DOB,
dbo_MF_PATIENT.Postcode,
Count(dbo_MF_PATIENT.HEYNo) AS CountOfHEYNo
FROM dbo_MF_PATIENT
GROUP BY dbo_MF_PATIENT.Forename,
dbo_MF_PATIENT.Surname,
dbo_MF_PATIENT.DOB,
dbo_MF_PATIENT.Postcode
HAVING (((Count(dbo_MF_PATIENT.HEYNo)) > 1));
My issue is I want to run this bit of code but only if the dbo_MF_PATIENT.MFPatientID appears in any of the 3 tables below:
dbo_ED_ATTENDANCE, db
Suppose im unsure on the joining because there is only ever one patient in the dbo_MF_PATIENT table but they could appear dozens of times in any of the other 3 tables.