Skip to content
Advertisement

Add amount from one row to amount in a different row with same primary key

I have a query where I would like to add the amount from one row to the amount of another row. Basically for any specific LLW, wherever WT_CPDS = ‘ASBESTOS’ and the first digit of FYP_NUM is not 5 or 6, id like to add the Obligation amount of this field to the obligation amount where WT_CPDS = ‘CONTIN’.

The field “MATCH” can also be used as a primary key since it is a unique identifier. I am using Oracle SQL Developer. Any help is much appreciated!

Advertisement

Answer

You can use window functions:

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