Hi!
Did you tried the query like below?
select L.StockID, L.InvNo, L.ItemNo, L.Qty, L.Cost, L.Date, ;
(NVL(sum(L2.Cost),0) + L.Cost <= m.lnCurrentStockBalance) as Include ;
from LatestStockInDetails L
left join LatestStockInDetails L2
on L2.StockID=L.StockID AND L2.Date<L.Date
Group By L.StockID, L.InvNo
>Hi,
> Becoz I need to deduct stock balance from the latest invoice to ealier.
>
>Any ideas?
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.