Re: get first and last row in one sql as two columns - Mailing list pgsql-general

From Thomas Kellerer
Subject Re: get first and last row in one sql as two columns
Date
Msg-id ms9fai$tpo$1@ger.gmane.org
Whole thread Raw
In response to Re: get first and last row in one sql as two columns  (Tom Smith <tomsmith1989sk@gmail.com>)
List 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 by date:

Previous
From: Tom Smith
Date:
Subject: Re: get first and last row in one sql as two columns
Next
From: Ray Stell
Date:
Subject: Installation of BDR from source