Subject RE: [firebird-support] Get the row number in a select
Author Sasha Matijasic
> Hi, is there some trick to get the row number of a query starting with
> 1, just using a select?
>
> row#, field1
> 1, a
> 2, b
> 3, c
> 4, d
> ... and so on
>

You can achieve it with something like this:

select s.id, count(*) rank
from s
join s r on s.id >= r.id
group by s.id

But you must know that this query is extremely slow, and you should do your row numbering on the client side anyway.

Sasha