Solución:
tratar:
SELECT
ROW_NUMBER() OVER(ORDER BY age) AS RowNumber
,count(*) as usercount
from users
group by age
Si es Oracle, use rownum
.
SELECT SOMETABLE.*, ROWNUM RN
FROM SOMETABLE
WHERE SOMETABLE.SOMECOLUMN = :SOMEVALUE
ORDER BY SOMETABLE.SOMEOTHERCOLUMN;
La respuesta final dependerá por completo de la base de datos que esté utilizando.
Para MySql:
SELECT @row := @row + 1 as row FROM anytable a, (SELECT @row := 0) r
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)