I have three tables:
PurchasesTable: PId, ItemId, PDate, ItemName, PQuantity, PPrice, PAmount.
SalesTable: SId, ItemId, SDate, ItemName, SQuantity, SPrice, SAmount.
I want to construct a query to make a StockTable: SDate, ItemId, ItemName, QuantityPurchased, QuantitySold, Balance.
The sample data of StockTable is attached in file herewith.
The problem I am having is with the Balance column. I want to calculate Balance as (Balance-(QuantityPurchased-QuantitySold)).
Please advise how I can fix this issue of Progressive Balance calculation of Stock.
PurchasesTable: PId, ItemId, PDate, ItemName, PQuantity, PPrice, PAmount.
SalesTable: SId, ItemId, SDate, ItemName, SQuantity, SPrice, SAmount.
I want to construct a query to make a StockTable: SDate, ItemId, ItemName, QuantityPurchased, QuantitySold, Balance.
The sample data of StockTable is attached in file herewith.
The problem I am having is with the Balance column. I want to calculate Balance as (Balance-(QuantityPurchased-QuantitySold)).
Please advise how I can fix this issue of Progressive Balance calculation of Stock.
Attachments
Last edited: