在Case语句SQL中使用数组



我一直在努力使以下代码发挥作用:

SELECT [Cell Name]
FROM ******* 
WHERE 
[Date of maturity year] = (CASE
WHEN [Inforce date month] = 12 THEN [Inforce date year] + 1
ELSE [Inforce date year]
END)                   
And [Date of maturity month] in (7,8,9) 

这目前正在工作,但我想使第二个where条件动态。我尝试过使用Case语句,但它不起作用。

[Date of maturity month] in (CASE
WHEN [Inforce date month] = 12 THEN (1,2,3)
WHEN [Inforce date month] = 3 THEN (4,5,6)
WHEN [Inforce date month] = 6 THEN (7,8,9)
ELSE (10,11,12)
END)

有人能帮我修一下吗。

[Date of maturity month] - [Inforce date month] % 12 between 1 and 3

相关内容

  • 没有找到相关文章

最新更新