Skip to content
Advertisement

Combining some of the rows and sum them up in oracle sql

I`m working on some data manipulation and have table:

Source Table

I need to have and output to look like:

enter image description here

Please suggest what can I use to combine and sum up those. I appreciate any input!

Thank you

Advertisement

Answer

You can use aggregation. Values are strings, so you probably want to concatenate them rather than sum them (which makes no sense in string context):

You can control the ordering of the results in the concatenated strings with the within group clause:

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement