SQLite
 sql >> Datenbank >  >> RDS >> SQLite

So verwenden Sie ROW_NUMBER in SQLite

Probieren Sie diese Abfrage aus

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

GEIGE

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