Search Postgresql Archives

Re: SELECT Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Mar 04, 2006 at 03:35:02 +1100,
  Alex <alex@xxxxxxxxxxxxxxx> wrote:
> Hi,
> i want to calculate the price difference, change% of 2 price records. Is 
> there an easy way to do that within one query, rather than writing a 
> function?

You can use a self join to do this. It won't be spectaculatly fast though.
The idea is too join each record to the record with the largest date less
than the date of the current record. Note that on record won't have a match.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux