can anyone give me some advice on the following situation:
I have two basic tables:


Then a view created by the two:
select product.IDPRODUCT, sum(quantity) as totalOut, PRODUCTSTORAGE.DATAINPUT, PRODUCTSTORAGE.TOTALIN
from PRODUCT
inner join COMMANDPRODUCT on commandproduct.idproduct = product.idproduct
inner join PRODUCTSTORAGE on PRODUCT.IDPRODUCT = PRODUCTSTORAGE.IDPRODUCT
group by product.idproduct, PRODUCTSTORAGE.DATAINPUT, PRODUCTSTORAGE.TOTALIN order by datainput asc;

How can you obsserva i have 4 records with idProduct = 28, and totalOut for all together is 18, and not individually.
To me that the result should look like the following:
I would like the result to look like this:

How could I do that?