[Solved] MS SQL Query for Opening Stock calculation


Thanks to all,

i have worked out with my same query, although seed was slow. query is mentioned below:-

select Item, Location,[Transaction Date],Price,Qty, Price_change , (select isnull(sum(qty),0) from #temp c where c.item=p.item and c.Location=p.Location and c.[Transaction Date] < p.[Transaction Date]) [Opening Stock] from #temp p

solved MS SQL Query for Opening Stock calculation