From: | Richard Broersma <richard(dot)broersma(at)gmail(dot)com> |
---|---|
To: | A B <gentosaker(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: How can I calculate differences between values |
Date: | 2009-11-10 14:56:17 |
Message-ID: | 396486430911100656r179ac488y8b8330bf54a2e10e@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, Nov 10, 2009 at 6:40 AM, A B <gentosaker(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | David Fetter | 2009-11-10 15:00:06 | Re: Editor for sgml files |
Previous Message | Greg Stark | 2009-11-10 14:52:15 | Re: Incremental Backups in postgres |