DECLARE @cnt INT = 1;
WHILE @cnt < (select max(id) FROM [Item])
BEGIN
update [Stock]
set [PurchaseQty] = (select [SaleQty] + [BalanceQty] FROM [Stock] where ItemId = @cnt)
where ItemId = @cnt
SET @cnt = @cnt + 1;
END;
WHILE @cnt < (select max(id) FROM [Item])
BEGIN
update [Stock]
set [PurchaseQty] = (select [SaleQty] + [BalanceQty] FROM [Stock] where ItemId = @cnt)
where ItemId = @cnt
SET @cnt = @cnt + 1;
END;
No comments:
Post a Comment