Hello,
How can I concatenate all of
CACSE(...)
result rows into into one?
Additionaly - is there a way to group multiple statements without "MAX" added into single entry?
Please check lines below, I might have been mistaken with part of it:
select
max(case when source_column_a in (value_1) then value else null) as "value_a",
(case when source_column_a in (value_2) then value else null) as "value_b",
(case when source_column_a in (value_3) then value else null) as "value_c",
max(case when source_column_a in (value_4) then value else null) as "value_d"
from table
group by ID, (case when source_column_a in (value_2) then value else null), (case when source_column_a in (value_3) then value else null);
example result:
value_a value_b value_c value_d
Amax (null) (null) Dmax
(null) B1 (null) (null)
(null) B2 (null) (null)
(null) B3 (null) (null)
(null) Bmax (null) (null)
(null) (null) C1 (null)
(null) (null) C2 (null)
(null) (null) C3 (null)
(null) (null) Cmax (null)
Results to achieve:
value_a value_b value_c value_d
Amax Bmax CMax Dmax
(null) B3 C3 (null)
(null) B2 C2 (null)
(null) B1 C1 (null)
value_a value_b value_c value_d
Amax Bmax, B3, B2, B1 Cmax, C3, C2, C1 Dmax
Regards,
What I have tried:
In situation related to additional one - query might have been modified more than once to include at least one of the cases in group by.