我试图在OpenEdge SQL-92查询中执行一个case语句,该查询可以有两列定义输出。
SELECT
"PERSON"."First",
"PERSON"."Last",
"PERSON"."EmpCode" as EmployeeCode,
CASE "PERSON"."Building"
WHEN '111' then 'HQ'
WHEN '222' then 'OPS'
WHEN '111' AND "PERSON"."EmpCode" = 'CCLASS' then 'MGMT'
END as Location
FROM ....
复合大小写在运行查询时抛出语法错误。我知道我可以在MSSQL中做到这一点......我想我也可以用于OpenEdge吗?
有关如何使用OpenEdge SQL实现这一点的想法吗?
根据没有名字的马提议:
CASE
WHEN "PERSON"."Building" = '111' then 'HQ'
WHEN "PERSON"."Building" = '222' then 'OPS'
WHEN "PERSON"."Building" = '111' AND "PERSON"."EmpCode" = 'CCLASS' then 'MGMT'
END as Location