This seems to be a strange question.
Fomson:
How can I subtract sales Quantity from the Totalstock for every transaction?
It's almost like you think it makes any sense to do so in a report (or SELECT query). How could it? The [Totalstock] value would be the same for each associated transaction. Consider that you might have a number of items in stock starting at 100 then twenty different transactions of four each (adding up to eighty). Any such report would show ninety-six for each line.
No. You have to be clear about what each value means. Is it stock as at some time in the past? Is it ever updated? Which of the transaction items have already been applied to the stock levels so should not be counted again?
It actually
is possible to get a reported value of stock items left using the original value and subtracting all relevant transactions, but as we've seen, this is not simple or straightforward. In practical terms most systems are designed so it is not required to process through all historical transactions (+ve & -ve) in order to determine the current status.
Fomson:
Am having too many logical errors Please someone help me
We can only really do that properly if/when you share with us some details of what you're trying to do and exactly what you're getting stuck on.