cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Case When

Hi experts

i want this code work i don't know how to use "OR" Fuction

CASE WHEN T1."LineTotal"=0 THEN 0 ELSE (-1)*T0."DiscSum" OR CASE WHEN T0."CANCELED"='C' THEN T0.'DiscSum" ELSE T0."DiscSum" END AS "Discount Amount"

Vitaliy-R
Developer Advocate
Developer Advocate

Could you share the complete SQL query to understand what you are trying to achieve?

yannmiquel
Participant
0 Kudos

Or write in plain text your query? It's hard to understand the left hand side of the OR...

Accepted Solutions (0)

Answers (1)

Answers (1)

venkateswaran_k
Active Contributor
0 Kudos

Hi

You have to use Union as below to get different case for a single column.

Below is the example. alter it according to your requirement.

SELECT 
CASE WHEN T1."LineTotal"=0 THEN 0 ELSE (-1)*T0."DiscSum" END AS "Discount Amount"
WHERE T1."LineTotal"= 0

UNION

SELECT 
CASE WHEN T0."CANCELED"='C' THEN T0.'DiscSum" ELSE T0."DiscSum" END AS "Discount Amount"
WHERE T0."CANCELED"='C'

Regards,

Venkat