इस क्वेरी को आजमाएं
select id, value, (select count(*) from tbl b where a.id >= b.id) as cnt
from tbl a
फिडल
| id | value | cnt |
--------------------
| 1 | yes | 1 |
| 3 | yes | 2 |
| 4 | yes | 3 |
| 6 | yes | 4 |
| 9 | yes | 5 |