Quantcast
Channel: Question and Answer » oracle
Viewing all articles
Browse latest Browse all 717

Arithmetic operations on a table

$
0
0

can anyone give me some advice on the following situation:

I have two basic tables:

enter image description here
enter image description here

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;

enter image description here

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:
enter image description here

How could I do that?


Viewing all articles
Browse latest Browse all 717

Trending Articles