Re: Add a ROWCOUNT to the output of a select.

Поиск
Список
Период
Сортировка
От Harald Fuchs
Тема Re: Add a ROWCOUNT to the output of a select.
Дата
Msg-id puskwli8i6.fsf@srv.protecting.net
обсуждение исходный текст
Ответ на Add a ROWCOUNT to the output of a select.  (Gavin 'Beau' Baumanis <gavinb@eclinic.com.au>)
Ответы Re: Add a ROWCOUNT to the output of a select.
Re: Add a ROWCOUNT to the output of a select.
Список pgsql-sql
In article <36af4bed0805131818p147bb440oa4c1944939e3b313@mail.gmail.com>,
"Robins Tharakan" <tharakan@gmail.com> writes:

> While we could always check for the query performance reasons, I
> rather think that this is an overkill for the purpose of mere line
> numbers.

> If such queries don't change frequently, you could be better off
> using a simple function that instead adds a 'rownumber' field to the
> output of the inner SQL query. The 'rownumber' could instead be
> calculated by simply incrementing it within a FOR loop for each row.

I think a sequence is much simpler:

create temp sequence tmp;
select nextval('tmp') as rownum,   contactdate
from   myTable
where   contactdate > '2007-06-30 23:59:59'
order by   contactdate;



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

Предыдущее
От: "Marcin Stępnicki"
Дата:
Сообщение: Re: Add a ROWCOUNT to the output of a select.
Следующее
От: "Marcin Stępnicki"
Дата:
Сообщение: Re: Add a ROWCOUNT to the output of a select.