Re: first_value/last_value

From: Adam Brusselback <adambrusselback(at)gmail(dot)com>
To: Tom Smith <tomsmith1989sk(at)gmail(dot)com>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: first_value/last_value
Date: 2016-05-19 01:08:11
Message-ID: CAMjNa7d2JmMx66FAk-bZJenXNKLO-sxhNBL01CbcrQDTq_k-Yg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Is there a reason you can't do that now with a limit 1/order by/union all?
Just have it ordered one way on the first query and the other on the
bottom. That will give you two rows that are the first / last in your set
based on whatever column you order on.
On May 18, 2016 8:47 PM, "Tom Smith" <tomsmith1989sk(at)gmail(dot)com> wrote:

> Hello:
>
> Is there a plan for 9.7 to enable using the two aggregate function
> as non-window function? i.e. enabling getting the first/last row
> in single sql without using window features.
> There is actually a C-extension for first()/last().
> I am wondering if 9.7 would make them built-in function like max/min
>
> Thanks
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2016-05-19 02:19:50 Re: first_value/last_value
Previous Message Tom Smith 2016-05-19 00:46:35 first_value/last_value