CREATE PROCEDURE `getTakeNum`(IN catid1 int,IN catid2 int,IN catid3 int,IN userid int,IN newtime int)
begin
select nexttime into @time from gift_user where id=userid;
select t into @num1 from gift_product where uid=userid and cid=catid1 order by t desc limit 0,1;
select t into @num2 from gift_product where uid=userid and cid=catid2 order by t desc limit 0,1;
select t into @num3 from gift_product where uid=userid and cid=catid3 order by t desc limit 0,1;
if @num1 < @time AND @num2 < @time AND @num3 < @time then
update gift_user set nexttime=newtime where id=userid;
end if;
end
为什么这个if条件(if @num1 < @time AND @num2 < @time AND @num3 < @time then)只要有1个成立就执行里面的代码了?难道说不能用并且的方式判断么?如果没有有什么办法?