The first part of the query before not in
runs and gives me a list of
Did you mean to write this?
WHERE (tblICD.descrip LIKE N'%diabetes%') and Patient.patientid not in
UPDATE
Would it be possible to rewrite the entire thing as this?
SELECT distinct Patient.patientid
FROM Patient INNER JOIN
patientICD ON Patient.patientid = patientICD.patientid AND Patient.admissiondate = patientICD.admissiondate AND
Patient.dischargedate = patientICD.dischargedate INNER JOIN
tblICD ON patientICD.primarycode = tblICD.ICD_ID
WHERE tblICD.descrip LIKE N'%diabetes%' AND tblICD.icd_id NOT LIKE N'25000'