我正在尝试在Cognos中实现嵌套CASE。 这是我的代码,
case
when ?Radio Button for selection? = 'Y'
then (substring( cast ([TN_Base_Views].[TktCoupon].[CouponStatusChangeDate], VARCHAR(10) ), 1, 7))
when ?Radio Button for selection? = 'M'
then (substring( cast ([TN_Base_Views].[TktCoupon].[CouponStatusChangeDate], VARCHAR(10) ), 1, 3))
when ?Radio Button for selection? = 'Q' and substring(cast ([TN_Base_Views].[TktCoupon].[CouponStatusChangeDate], VARCHAR(10) ), 1, 3) contains ('01', '02', '03') then 'Q1'
when ?Radio Button for selection? = 'Q' and substring( cast ([TN_Base_Views].[TktCoupon].[CouponStatusChangeDate], VARCHAR(10) ), 1, 3) contains ('04', '05', '06') then 'Q2'
when ?Radio Button for selection? = 'Q' and substring( cast ([TN_Base_Views].[TktCoupon].[CouponStatusChangeDate], VARCHAR(10) ), 1, 3) contains ('07', '08', '09') then 'Q3'
when ?Radio Button for selection? = 'Q' and substring( cast ([TN_Base_Views].[TktCoupon].[CouponStatusChangeDate], VARCHAR(10) ), 1, 3) contains ('10', '11', '12') then 'Q4'
end
我在验证代码时收到解析错误。请帮帮我。
答案 0 :(得分:1)
我用" IN"而不是" CONTAINS"