lo为自变量,ChannelIndex为表字段 set @lo = 0; update t_devicechannel set ChannelIndex = (@lo:=@lo + 1) where ID > '20184';