Re: How can I calculate differences between values

From: A B <gentosaker(at)gmail(dot)com>
To: Vyacheslav Kalinin <vka(at)mgcp(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How can I calculate differences between values
Date: 2009-11-10 15:56:06
Message-ID: dbbf25900911100756o17a6c5e8xb9abd2b113c9fde3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> With 8.4's analytic capabilities you can do this:
> select * from (
>   select userid, data - lag(data) over (partition by userid order by data)
> diff
>     from foo) q
>   where diff is not null;

Thank you! That worked perfectly!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thom Brown 2009-11-10 15:56:21 Re: -c argument not recognized
Previous Message Antonio Ruggiero 2009-11-10 15:26:56 -c argument not recognized