Skip to content
Advertisement

SQL oracle SUM function with conditions

I have a table that looks like this

How I need the results to be is like this

hopefully that gives you a better image, but basically I would need to do a SUM depending on the distinct value of the other columns. The accounts that were previously in rows would be changed into columns.

any ideas or help with this would be greatly appreciated

Advertisement

Answer

Try the following, here is the demo.

Output:

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