我想知道是否有可能枚举回来。不是根据任何列的内容,而是产生连续的整数索引。 ' m/ ]+ [# h. ?% [3 i" ]select ?,count(*) as usercount from users group by age返回一些内容: 7 P) ]0 ]+ p1 K0 B8 J122 122 783 444 422 4222 它用于https://data.stackexchange.com/ c3 j1 K( d7 h1 H8 I( W4 M 0 m% Y' l! H5 K* O {解决方案: ' |* A/ N. k/ }
尝试:7 }7 ~ E C$ p, N3 V
SELECT ROW_NUMBER() OVER(ORDER BY age) AS RowNumber count(*) as usercount from users group by age