Compound case for Progress DB

Discussão em 'StackOverflow' iniciado por fdantas, Janeiro 29, 2016.

  1. fdantas

    fdantas Administrator Moderador

    I'm trying to do a case statement in an OpenEdge SQL-92 query that can have two columns defining the output.

    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 ....


    The compound case is throwing a syntax error when I run the query. I know I can do this in MSSQL... I assume I can for OpenEdge as well?

    Any thoughts on how this is accomplished in with OpenEdge SQL?

    Proposed based on horse with no name's suggestion:

    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

    Continue reading...

Compartilhe esta Página