I have below table IS_ID:
I want to create View based on this table with having some calculation. For each Identifier there will be two rows, one for ALLOCATIONASSETTYPE = 'Cash' and second for ALLOCATIONASSETTYPE = 'Other'
In first Row where ALLOCATIONASSETTYPE = 'Cash':
For example for each same IDENTIFIER i wanted to sum the ALLOCATIONPERCENTAGE where ALLOCATIONASSETTYPE = 'Cash'.
For each same Identifier i wanted to sum MARKETVALUEHELD where ALLOCATIONASSETTYPE = 'Cash'.
In second row where ALLOCATIONASSETTYPE = 'Other':
For example i want to do below calculation:
100 - sum of all ALLOCATIONPERCENTAGE where ALLOCATIONASSETTYPE ! = 'Cash' - sum the ALLOCATIONPERCENTAGE where ALLOCATIONASSETTYPE = 'Cash'
At the end it will look like below for example :
(IDENTIFIER, ALLOCATIONPERCENTAGE, MARKETVALUEHELD, ALLOCATIONASSETTYPE) VALUES ('IE0031069382', 0.4451, 552520.67, 'Cash');
(IDENTIFIER, ALLOCATIONPERCENTAGE, MARKETVALUEHELD, ALLOCATIONASSETTYPE) VALUES ('IE0031069382', 56.8158, null, 'Other');
Is it possible to create View in such case ? Is it possible to keep the existing IDENTIFIER data as well then for each Identifier we can add two more rows for allocationassettype = 'Cash' and allocationassettype = 'Other'? So i can see existing data as well for each Identifier and also see this two new rows ?