1 select distinct Num as ConsecutiveNums from 2 ( select Num, 3 case 4 when @pre=Num then @count:=@count+1 5 when (@pre:=Num) is not NULL then @count:=1 6 end as n 7 from Logs,(select @pre:=NULL)r,(select @count:=0)c 8 ) as a where a.n>=3;
想问一下 第5行代码的(@pre:=Num)的括号 有和没有 有什么区别?