我有一个代码,其中有此语句
when d.ID in (1,2,3,4,5,6,7,8)
then
case
when d.today < '01/01/2001'
then
122
else
124
end
end,
case
when d.today < '10/10/2018'
then
121
ELSE
125
end
end
case语句抛出一个错误,说明语法不正确,我在这里缺少的东西似乎无法得到它
答案 0 :(得分:0)
逗号没有意义。也许您想要else
:
when d.ID in (1,2,3,4,5,6,7,8)
then (case when d.today < '2001-01-01'
then 122
else 124
end)
else (case when d.today < '2018-10-10'
then 121
else 125
end)
答案 1 :(得分:0)
检查此-
CASE
WHEN d.ID IN(1, 2, 3, 4, 5, 6, 7, 8)
THEN
CASE
WHEN d.today < '01/01/2001' THEN 122
ELSE 124
END
ELSE
CASE
WHEN d.today < '10/10/2018' THEN 121
ELSE 125
END
END;