日期:2014-05-19  浏览次数:20668 次

求代码
如果存在记录(比如num=66)就把@i增加1

declare   @i
set   @i=0

表格如下:
id     num  
01     22
02     11
03     33
04     66
..     ..



------解决方案--------------------
select @i=(case when num=66 then @i+1 else @i end)
from T