'POSTGRESQL SUM a subquery Sylob 5

I am working with Sylob's (an ERP) compiler and I am having troubles summing a subquery.

This picture show what I get

I want to remove the first column to sum the 3rd and 4rth and GROUP By the 2nd, but if I do so, I can't use my subqueries because they depend on it

Can anyone give me a hand on this ?

Have a nice week

I can't link my code, I don't know how to enter code here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source