1、SET @i = 0; SELECT (@i:=@i+1) AS i FROM major;
2、SELECT (@i:=@i+1) AS i FROM major,(SELECT @i:=0) t;