Re: obtaining difference between minimum value and next in size

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "John Lister" <john(dot)lister-ps(at)kickstone(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: obtaining difference between minimum value and next in size
Date: 2010-11-17 15:42:36
Message-ID: 27014.1290008556@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"John Lister" <john(dot)lister-ps(at)kickstone(dot)com> writes:
> Is it possible to obtain the difference between just the minimum price and the next one up per product,

If you're using >= 8.4, try a window function. LEAD or LAG ought to
do it.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Andreas Kretschmer 2010-11-17 16:02:16 Re: obtaining difference between minimum value and next in size
Previous Message John Lister 2010-11-17 15:11:32 obtaining difference between minimum value and next in size