select c.id,(@j:=@j+1) as cnum from client c,(select @j :=0)b; 结果: select @j :=0 创建j变量,赋初始值为0,@j:=@j+1为步增1。