请帮助我解决此IF声明

时间:2019-06-14 08:45:27

标签: sql if-statement case

我无法获取此代码。我想念什么?

这是一条新语句,它是内部数据库的一部分,但我无法接受它。

SELECT "Human Resources - Assignment EIT Details"."Employment Attributes"."Employee Latest Start Date", "Assignment"."Incremental Date"

CASE

WHEN "Assignment"."Incremental Date" IS NULL THEN "Human Resources - Assignment EIT Details"."Employment Attributes"."Employee Latest Start Date"
ELSE "Assignment"."Incremental Date" END;

我希望输出显示递增日期,但是如果该字段为NULL,则需要显示Employee Latest Start Date

1 个答案:

答案 0 :(得分:0)

正确的代码是;

CASE WHEN "Human Resources - Assignment EIT Details"."Assignment"."Incremental Date" IS NULL 
THEN "Human Resources - Assignment EIT Details"."Employment Attributes"."Employee Latest Start Date" 
ELSE "Human Resources - Assignment EIT Details"."Assignment"."Incremental Date" 
END