Re: obtain the difference between successive rows

From: Berend Tober <btober(at)broadstripe(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: obtain the difference between successive rows
Date: 2012-10-20 21:00:28
Message-ID: 508310EC.8070207@computer.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Виктор Егоров wrote:
> 2012/10/20 Berend Tober <btober(at)broadstripe(dot)net>:
>> Your suggestion almost worked as is for this, except that you have to note
>> that reading for meter #2 and meter #3 overlap ...
> You can do
> … OVER(PARTITION BY electric_meter_pk ORDER BY reading_date)
> to split you data by meter.
>

That looks like it works great! Much simpler-looking SQL than what I was
working on.

Thanks!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2012-10-21 05:00:12 Re: Create extension tablefunc fails with "wrong ELF class: ELFCLASS32"
Previous Message Jeff Janes 2012-10-20 18:42:54 Re: Create extension tablefunc fails with "wrong ELF class: ELFCLASS32"