有人可以帮我解决我的计算公式。我不能让它发挥作用。以下是我正在实施的想法。谢谢。
CASE WHEN REASONFORNOE10 IS NULL THEN TOT_SCORE = [q_1]+[q_2]+[q_3]+[q_4]+[q_5]+[q_6]+[q_7]+[q_8]+[q_9]+[q_010]
WHEN REASONFORNOE10 IS NOT NULL THEN TOT_SCORE = '99'
ELSE '' END
答案 0 :(得分:0)
尝试以下方法。这可能会对您有所帮助:
如果您希望将结果作为字符串值,请按以下步骤操作:
SELECT TOT_SCORE=CASE WHEN REASONFORNOE10 IS NULL THEN CAST([q_1]+[q_2]+[q_3]+[q_4]+[q_5]+[q_6]+[q_7]+[q_8]+[q_9]+[q_010] AS VARCHAR)
WHEN REASONFORNOE10 IS NOT NULL THEN '99'
ELSE '' END
否则你想要数值,试试这个:
SELECT TOT_SCORE=CASE WHEN REASONFORNOE10 IS NULL THEN [q_1]+[q_2]+[q_3]+[q_4]+[q_5]+[q_6]+[q_7]+[q_8]+[q_9]+[q_010]
WHEN REASONFORNOE10 IS NOT NULL THEN 99
ELSE 0 END