I currently have a lot of checks in my process and I want to reduce this
CASE WHEN {A > B} THEN 1 ELSE 0 END AS COL1
CASE WHEN {A = B} THEN 1 ELSE 0 END AS COL2
CASE WHEN {A < B} THEN 1 ELSE 0 END AS COL3
for this (something like)
CASE WHEN {A > B} THEN 1 AS COL1, 0 AS COL2, 0 AS COL3
ELSE CASE WHEN {A = B} THEN 0 AS COL1, 1 AS COL2, 0 AS COL3
ELSE 0 AS COL1, 0 AS COL2, 1 AS COL3
in my case, it's NECESSARY to do it this way, as these three columns already exist and i need to reduce the processing
case
is an expression that returns a single value. You could return a single value to indicate the relationship. Splitting the comparison in three columns is overkill. – Gordon Linoff