Ok all you SQL scripting experts this novice needs some help.
I am trying to find all patients that have a HDID = 93634 and = 345865.
I can do one or the other but can't seem to figure out how to do both. This is from the OBS table.
Thanks,
Cecil
This one is for if they have had either or::::
SELECT *
FROM PatientProfile
WHERE (SELECT COUNT(*) FROM OBS WHERE HDID IN (93634, 345865) AND PID = PatientProfile.PID AND CHANGE IN (0,2)) > 0 AND PSTATUS = 'A'
This one is if they have had both:::
SELECT *
FROM PatientProfile
WHERE (SELECT COUNT(*) FROM OBS WHERE HDID = 93634 AND PID = PatientProfile.PID AND CHANGE IN (0,2)) > 0 AND
(SELECT COUNT(*) FROM OBS WHERE HDID = 345865 AND PID = PatientProfile.PID AND CHANGE IN (0,2)) > 0 AND PSTATUS = 'A'
thanks, I new someone would have the answer..
no problem, anytime. 🙂