query Get Balances in Oracle table stock
<p>i have sample data in oracle data table namely <strong>STOKREWARD</strong> table, i wanna get balance between quantity <strong>IN</strong> and quantity <strong>OUT</strong>.</p>

<p><a href="https://i.stack.imgur.com/rYmdR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rYmdR.png" alt="enter image description here"></a></p>

<p>i wanna get value <strong>BALANCES</strong> like this:</p>

<p><a href="https://i.stack.imgur.com/lGuTh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lGuTh.png" alt="enter image description here"></a></p>

<p>i try using query like this, but the result doesn't i want</p>

<pre><code>SELECT STOKREWARD.NO, STOKREWARD.DODATE, STOKREWARD.REWARDNAME, STOKREWARD.NOTES,
STOKREWARD.QTYIN, STOKREWARD.QTYOUT,
(STOKREWARD.QTYIN- STOKREWARD.QTYOUT) AS BALANCES
FROM STOKREWARD
ORDER BY STOKREWARD.NO ASC
</code></pre>

<p>this query gives result:</p>

<p><a href="https://i.stack.imgur.com/9usja.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9usja.png" alt="enter image description here"></a></p>

<p>anyone can help me? thanks</p>