|
|
|
|
Re: running total query [message #677604 is a reply to message #677454] |
Mon, 30 September 2019 06:10 |
Bill B
Messages: 1971 Registered: December 2004
|
Senior Member |
|
|
Try this
SELECT Inventory_item_id,
Organization_id,
TRUNC (Transaction_date)
Transaction_date,
SUM (Primary_quantity)
OVER (ORDER BY TRUNC (Transaction_date)
ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING)
Opening_balance,
SUM (Primary_quantity)
OVER (ORDER BY TRUNC (Transaction_date)
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
Closing_balance
FROM Mtl_material_transactions
WHERE Inventory_item_id = 37155
AND Organization_id = 290
AND Subinventory_code IN ('Fresh', 'Hold')
ORDER BY TRUNC (Transaction_date);
|
|
|