📜  mysql 从 n 更新到 100 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:12.296000             🧑  作者: Mango

代码示例1
SET @rank:=0;
update tablename
set fieldname =@rank:=@rank+1;

#OR

UPDATE tablename
JOIN (SELECT @rank := 0) r
SET fieldname=@rank:=@rank+1;