I searched this in stackoverflow and found Concatenate multiple columns and also Concatenate multiple rows. But what I need is combine them both.
I have table named komponen :
id urut tipe c_string c_number op
---------------------------------------------
A1 1 S GP NULL *
A1 2 N NULL 5 /
A1 3 N NULL 100 + //Ignore the last op for each groups.
A2 1 S GP NULL -
A2 2 N NULL 1000 / //Ignore the last op for each groups.
Desired result :
id concat_result
------------------------
A1 GP * 5 / 100
A2 GP - 1000
This might be use LISTAGG
and GROUP BY
method. But I don't have any clue how to do this and achieve the desired result. Please help.