FIFO Stock Valuation Through CTE-Recursion
问题 I have copied it from this site because it's been already closed but I needed it for further solution. thus, kindly help me out..... Problem : it's calculating the closing stock valuation through FIFO of issue as a whole. but i need cost of issues into Price column in the same row it belongs to itself. declare @Stock table (Item char(3) not null,[Date] datetime not null,TxnType varchar(3) not null,Qty int not null,Price decimal(10,2) null) insert into @Stock(Item , [Date] , TxnType, Qty,