SELECT @numlist:=0; update t_article a, (SELECT @orderItem:=0) b set s_id = @numlist + (@orderItem:=@orderItem+1);