您好所有。
请帮助。
我有如下表...
Book_Issue
ID NO_OF_DAYS
1月15日
2月13日
3 7
4 2
5月12日
我想更新的每一行,将扣除NO_OF_DAYS有一天,意味着每天的人数将扣除一个。我做了一些这样的事,但其更新的值相同的所有行。
Declare @loop as int,@Count as int,@Days as int
Set @Days = 0
Set @Count = 0
Set @loop = 0
Select @Count = Count(*) from book_issue_Detail
While(@loop!=@Count)
Begin
Select @Days = no_of_Days from book_issue_detail
update book_issue_detail set no_of_days = @Days - 1
set @loop = @loop + 1
End