I have a SELECT statement, part of which is a "Flags" column which is a CASE function, but I need to be able to concatenate the results together. Example: in the below, I need to be show both "@" and "K" if both of the CASE blocks are true… Possible?
<snip>
CASE WHEN stkeoq(stock.code) = -1 THEN '@'
WHEN stock.kit_pack = 'Y' THEN 'K'
END AS "flags",
<snip>
Note: "stkeoq" is a function
The actual CASE is going to end up with 7 individual tests and therefore 7 difference flags that I'll need to test and concatenate all the true ones…
With a CASE you will need to provide all possible combinations. But perhaps there is a way to put the two separate CASE statements together with a || concatenation:
CASE WHEN stkeoq(stock.code) = -1 THEN '@' ELSE '' END || CASE WHEN stock.kit_pack = 'Y' THEN 'K' ELSE '' END AS "flags"