我有以下代码(在Oracle BI中)
SELECT CASE
WHEN
Year("Assignment Inactive Date") = 4712
THEN 'THIS'
ELSE 'ELSE'
END
FROM thisTable
这很有效。相应地显示THIS
和ELSE
。但是,如果我将其更改为以下内容,则会收到错误错误:expected CHAR got DATE
SELECT CASE
WHEN
Year("Assignment Inactive Date") = 4712
THEN 'THIS'
ELSE "Assignment Inactive Date"
END
FROM thisTable
最后,如果我执行以下操作,则一切都是空白的。返回行,但一切都是空白的。有什么想法吗?
SELECT CASE
WHEN
Year("Assignment Inactive Date") <> 4712
THEN "Assignment Inactive Date"
END
FROM thisTable
显示A和B
SELECT CASE
WHEN
year("Assignment Inactive Date") = 4712
THEN
'A'
ELSE
'B'
END
仅显示A的
SELECT CASE
WHEN
year("Assignment Inactive Date") = 4712
THEN
'A'
ELSE
CAST("Assignment Inactive Date" AS VARCHAR(20))
END