SQLite
 sql >> Database >  >> RDS >> SQLite

Come utilizzare ROW_NUMBER in sqlite

Prova questa query

select id, value, (select count(*) from tbl b  where a.id >= b.id) as cnt
from tbl a

VIOLINO

| id | value | cnt |
--------------------
|  1 |   yes |   1 |
|  3 |   yes |   2 |
|  4 |   yes |   3 |
|  6 |   yes |   4 |
|  9 |   yes |   5 |