Re: enumerating rows

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: enumerating rows
Дата
Msg-id Pine.LNX.4.30.0104130037250.1148-100000@peter.localdomain
обсуждение исходный текст
Ответ на enumerating rows  (Kovacs Zoltan <kovacsz@pc10.radnoti-szeged.sulinet.hu>)
Список pgsql-sql
Kovacs Zoltan writes:

> Maybe a trivial question, maybe it's foreign from SQL, I'dont know...
> How to add a column which stands for the row number in each row of the
> result? E.g.:
>
> row_no | column1 | column2 | ...
> -------+---------+---------+ ...
>      1 | datum11 | datum12 | ...
>      2 | datum21 | datum22 | ...
>    ... |     ... |     ... | ...
>
> I didn't find anything in the docs.

Your client can do that.  When you fetch the results you have to have some
sort of loop anyway, so you have (or keep) a counter there.  There's no
use of the server generating this information, because the numbering is
implied by the order in which the rows are sent.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/



В списке pgsql-sql по дате отправления:

Предыдущее
От: Joel Burton
Дата:
Сообщение: Re: DROP TABLE in transaction
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Update