SELECT * FROM test;
SELECT (@sn :=@sn + 1) sn,a.* from test a,(select @sn :=0) b;
SQL MySQL 序号 https://blog.xqlee.com/article/748.html