get first and last row in one sql as two columns

Поиск
Список
Период
Сортировка
От Tom Smith
Тема get first and last row in one sql as two columns
Дата
Msg-id CAKwSVFEjy_q+gCPAri_q40tFx4ZUiLG6BaY+o9A69HXbH7FCPg@mail.gmail.com
обсуждение исходный текст
Ответы Re: get first and last row in one sql as two columns  (Rob Sargent <robjsargent@gmail.com>)
Re: get first and last row in one sql as two columns  (Rob Sargent <robjsargent@gmail.com>)
Re: get first and last row in one sql as two columns  ("Dickson S. Guedes" <listas@guedesoft.net>)
Список pgsql-general
Hi:

I need to get the first and last tow in one sql like below

select first(col1), last(col1) from table order by col1

I saw some posting in wiki with a custom function (or C extention)
to do this.   Is it widely used and reliable?
https://wiki.postgresql.org/wiki/First/last_(aggregate)

I am wondering why these two functions are not part of postgresql built-in
functions as it has many use cases

Thanks

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

Предыдущее
От: Melvin Davidson
Дата:
Сообщение: Re: bdr admin role
Следующее
От: Rob Sargent
Дата:
Сообщение: Re: get first and last row in one sql as two columns