Subject | RE: [firebird-support] Get the row number in a select |
---|---|
Author | Sasha Matijasic |
Post date | 2008-03-28T15:03:31Z |
> Hi, is there some trick to get the row number of a query starting withYou can achieve it with something like this:
> 1, just using a select?
>
> row#, field1
> 1, a
> 2, b
> 3, c
> 4, d
> ... and so on
>
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