cancel
Showing results for 
Search instead for 
Did you mean: 

examples in a query using "CASE" IN FSM

0 Kudos
373

hello teams

Could you give me some examples of how to use the "CASE" statement within a query in the analysis and reporting module, since when using the one that sql throws me an error.

EXAMPLE

SELECT

SC.priority

CASE

WHEN SC.priority = 'HIGH' THEN 'Alta'

WHEN SC.priority = 'MEDIUM' THEN 'Media'

ELSE 'Baja'

END AS PRIORITY_TRASLATE

FROM

ServiceCall SC

ERROR

CA-113: Query syntax error at position [4] for [SELECT SC.priority CASE WHEN SC.priority = 'HIGH' THEN 'Alta' WHEN SC.priority = 'MEDIUM' THEN 'Media' ELSE 'Baja' END AS prioridad FROM ServiceCall SC LIMIT 1000]. See: [CASE].

View Entire Topic
Harish_Vatsa
Active Contributor

Dear rubesala1983,

Can you please try the following:

SELECT
SC.priority,
CASE
WHEN SC.priority = 'HIGH' THEN 'Alta'
WHEN SC.priority = 'MEDIUM' THEN 'Media'
ELSE 'Baja'
END AS PRIORITY_TRASLATE
FROM
ServiceCall SC
LIMIT 1000;

--

Regards,

H.V.

Harish_Vatsa
Active Contributor

Kindly use the query as it is to make sure it is properly structured.

0 Kudos

harishvatsa hi,

in fact don't works look this: