16.06.2017, 04:32
Hay una manera mбs eficiente de hacer eso usando solo la consulta de sql.
ejemplo.
SET @pos=0;
SELECT @pos:=@pos+1,name FROM players ORDER BY score DESC;
ejemplo.
SET @pos=0;
SELECT @pos:=@pos+1,name FROM players ORDER BY score DESC;