mysql 我想写一个循环如下 总是报错 告诉们看下要怎么执行才能成功 50
declareiintSETi:=1while(i<4)doselects:=SUM(pQuantity)frompackbuyrecwherepackIdIN(sele...
declare i int
SET i:= 1
while (i < 4) do
select s:=SUM(pQuantity) from packbuyrec
where packId IN(select 套餐编号 from temp_pack where Id =1);
UPDATE temp_pack set 销售数量=@swhere Id =1;
set i = i +1;
end while; 展开
SET i:= 1
while (i < 4) do
select s:=SUM(pQuantity) from packbuyrec
where packId IN(select 套餐编号 from temp_pack where Id =1);
UPDATE temp_pack set 销售数量=@swhere Id =1;
set i = i +1;
end while; 展开
2个回答
展开全部
declare i int;
declare s decimal;
SET i= 1;
while i < 4 do
select SUM(pQuantity) into s from packbuyrec
where packId IN(select 套餐编号 from temp_pack where Id =1);
UPDATE temp_pack set 销售数量=s where Id =1;
set i = i +1;
end while;
2013-05-06
展开全部
SET i:= 1 啥玩意。。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询