NOT IN query not working, SQL Server 2008

前端 未结 5 1207
伪装坚强ぢ
伪装坚强ぢ 2021-01-27 09:15

\"enter

The first part of the query before not in runs and gives me a list of

5条回答
  •  清歌不尽
    2021-01-27 09:57

    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'
    

提交回复
热议问题