Re: get first and last row in one sql as two columns

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: get first and last row in one sql as two columns
Дата
Msg-id ms9fai$tpo$1@ger.gmane.org
обсуждение исходный текст
Ответ на Re: get first and last row in one sql as two columns  (Tom Smith <tomsmith1989sk@gmail.com>)
Список pgsql-general
Tom Smith schrieb am 03.09.2015 um 14:11:
>>
>>     SELECT first_value(col1) over (order by col1),
>>            last_value(col1)  over (order by col1)
>>     FROM table;
>>

> The window function works for me (with adding limit 1 in the end to output only one row
> needed instead of many duplicate rows).


If that works for you with a LIMIT 1, then I don't understand why

   select min(col1), max(col1)
   from table

doesn't work for you





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

Предыдущее
От: Tom Smith
Дата:
Сообщение: Re: get first and last row in one sql as two columns
Следующее
От: Ray Stell
Дата:
Сообщение: Installation of BDR from source