Re: obtain the difference between successive rows

Поиск
Список
Период
Сортировка
От Chris Angelico
Тема Re: obtain the difference between successive rows
Дата
Msg-id CAPTjJmpJ8JgJFLyipUU5vRF_qbH+f__R0g9js08+j9QSNx2tVA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: obtain the difference between successive rows  (Berend Tober <btober@broadstripe.net>)
Ответы Re: obtain the difference between successive rows  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On Sun, Oct 21, 2012 at 2:30 AM, Berend Tober <btober@broadstripe.net> wrote:
> What about if there is more than one column you want the difference for (...
> coincidentally I am writing a article on this topic right now! ...), say a
> table which is used to record a metered quantity at not-quite regular
> intervals:
> ...
>
> I am working on a write-up of a neat solution using CTE's, but would be
> interested in other's views.

To be quite honest, I would simply read the table directly and then do
the processing in an application language :) But two window functions
should do the trick. Whether or not it's actually more efficient that
way is another question.

ChrisA


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

Предыдущее
От: Berend Tober
Дата:
Сообщение: Re: obtain the difference between successive rows
Следующее
От: Thalis Kalfigkopoulos
Дата:
Сообщение: Re: obtain the difference between successive rows