From: | Alex <alex(at)meerkatsoft(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | SELECT Question |
Date: | 2006-03-03 16:35:02 |
Message-ID: | 44087036.7050409@meerkatsoft.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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?
Example:
company, price_date, price, change, change_perc
compA, 20060203,100,,,
compA, 20060202,100,,,
compA, 20060201,100,,,
for one, i would like to calculate for one date the changes (price, and
percentage) to the previous day and update the record.
i also want to be able to run that through the entire history to
re-calculate the changes i.e. not only update one record but update all
of these.
Currently I am doing it with a function but I wonder if there is an
easier and faster way.
Any suggestion or help would be appreciated.
Thanks in advance
Alex
From | Date | Subject | |
---|---|---|---|
Next Message | Sascha Nepper | 2006-03-03 16:38:45 | Re: ERROR: column "datpath" does not exist |
Previous Message | Just Someone | 2006-03-03 16:17:24 | Re: SELinux strangeness with 8.1.2 and 8.1.3 |