The way I implemented my table, I registered all transactions to facilitate index and history. In index, I show only my positive stocks and they can be repeated if bought more than once (We also have to savet the price of each transaction). I sum the shares only to calculate and show the totals.
But, when I make sales I would have to zero each row of a specific stock until I exhaust the amount of sold shares. Any hints on how to make this UPDATE within SQL?
P.S. Before I sell, I check to see the amount of wanted shares to sell are less than the total available shares of that given stock.