赋值为0时还是null 赋值成1时就正常的
when后给 判断语句。你这个是给的是赋值语句。 因为@m:= 0 则为false了。
你改一下就知道其实是赋值上了 select case when @m:=0 then @m else @m end as num