Re: How can I calculate differences between values - Mailing list pgsql-general

From Richard Broersma
Subject Re: How can I calculate differences between values
Date
Msg-id 396486430911100656r179ac488y8b8330bf54a2e10e@mail.gmail.com
Whole thread Raw
In response to How can I calculate differences between values  (A B <gentosaker@gmail.com>)
List pgsql-general
On Tue, Nov 10, 2009 at 6:40 AM, A B <gentosaker@gmail.com> wrote:

> For example
> if the table contains:
>
> 4, 100
> 5, 200
> 5, 210
> 5, 231
>
>
> I want the values
>
> 5,10
> 5,21

> I guess that will work, but I'm curious, are there other ways?

I think this kind of operation is best suited for CTEs and Windowing.
I just wish I was more experienced with it to give more specific
advice.  However, here are the doc that might start you on the right
path:
http://www.postgresql.org/docs/8.4/interactive/sql-expressions.html#SYNTAX-WINDOW-FUNCTIONS
http://www.postgresql.org/docs/8.4/interactive/sql-select.html

--
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug

pgsql-general by date:

Previous
From: Greg Stark
Date:
Subject: Re: Incremental Backups in postgres
Next
From: Vyacheslav Kalinin
Date:
Subject: Re: How can I calculate differences between values