I would like to return multiple values in my case statement, such as :
SELECT
CASE
WHEN THEN
WHEN
Depending on your use case, instead of using a case statement, you can use the union of multiple select statements, one for each condition.
My goal when I found this question was to select multiple columns conditionally. I didn't necessarily need the case statement, so this is what I did.
For example:
SELECT
a1,
a2,
a3,
...
WHERE
AND ()
UNION
SELECT
b1,
b2,
b3,
...
WHERE
AND ()
UNION
SELECT
...
-- and so on
Be sure that exactly one condition evaluates to true at a time.
I'm using Postgresql, and the query planner was smart enough to not run a select statement at all if the condition in the where clause evaluated to false (i.e. only one of the select statement actually runs), so this was also performant for me.