陈述

时间:2017-04-04 16:16:12

标签: sql sql-server

我收到一个错误,说明在预期条件的上下文中指定了非布尔类型的表达式,该语句有什么问题?

CASE WHEN (TEAR.REASONS_FOR_TEARDOWN IN (21,17) 
           AND (SELECT COUNT(ELEMENTNAME) 
                  FROM EINSPECTION_TABLE T 
                        INNER JOIN EINSPECTION_MAIN M 
                              ON T.ELEMENTID=M.ELEMENTID 
                 WHERE ELEMENTTYPE = 'TD' 
                   AND ENGINEID=1650 
                   AND STATUS IN (1126,1127))>1) 
     THEN 'YC' 

2 个答案:

答案 0 :(得分:0)

您需要/stuff end表达式。可选择包含case

else

答案 1 :(得分:-1)

情况(TEAR.REASONS_FOR_TEARDOWN IN('21','17')

此外,您需要一个案例的结束语句