格式
SELECT (@rowNO := @rowNo+1) AS rowno FROM (
SELECT * FROM (自己的表名)
) a,(SELECT @rowNO :=0) b
例子:根据分数排名并且加上排名名次字段rowno
SELECT (@rank := @rank+1) AS rank,a.name,a.score FROM (
SELECT s.name,s.score FROM student s order by s.score
) a,(SELECT @rank :=0) b