I have this code:
SELECT DISTINCT
CASE
    WHEN abc > def THEN 'abc is larger than def'::text
    ELSE NULL::text
END AS case1,
CASE
    WHEN abc < ghi THEN 'def is larger than abc'::text
    ELSE NULL::text
END AS case2,
CASE 
    WHEN abc > jkl THEN 'abc is larger than jkl'::text
    ELSE NULL::text
END AS case3,
This looks like this:
-------------------------------------------------------------------------------------
|              case1          |           case2          |          case3           |
-------------------------------------------------------------------------------------
|    'abc is larger than def' | 'def is larger than abc' | 'abc is larger than jkl' |
-------------------------------------------------------------------------------------
What I want to do is to create a column called 'casesCombined', than would combine 'then's'. For example, if top 2 cases are true, then column 'casesCombined' would be '"abc is larger than def", "def is larger than abc"'.
Like this:
-----------------------------------------------------
|                  casesCombined                    |
-----------------------------------------------------
| 'abc is larger than def', 'def is larger than abc'|
-----------------------------------------------------
Tried many ways, not able to figure out. I also don't need those 'case1', 'case2'...
 
     
    