尝试计算有多少患者有某种类型的诊断,这应该返回3,但它返回5,所以想知道是否有一种方法可以计算多个条件的一列?
SELECT COUNT(Diagnosis_1) AS '85th %'
FROM PROBLEM
WHERE ENCOUNTER_DATE BETWEEN '01/06/2016' AND '01/06/16'
AND DIAGNOSIS_1 = '27800'
OR DIAGNOSIS_1 = 'V8553'
答案 0 :(得分:1)
检查逻辑运算和数据格式的优先级('01/06/2016' == '01/06/16'
):
SELECT COUNT(Diagnosis_1) AS [85th %]
FROM PROBLEM
WHERE ENCOUNTER_DATE = '20160601'
AND DIAGNOSIS_1 IN ('27800', 'V8553')