时间:2021-07-01 10:21:17 帮助过:20人阅读
open wu
fetch next from wu into @pro
while @@fetch_status=0
begin
select @mm=sum([cost]) from mytest where [product]=@pro
delete from mytest where [product]=@pro
insert into mytest ([product],[cost]) values(@pro,@mm)
fetch next from wu into @pro
end
close wu
deallocate wu
GO
我们可以使用作业进行相应的数据的更新