From: | "Johnson, Shaunn" <SJohnson6(at)bcbsm(dot)com> |
---|---|
To: | PostgreSQL General Mailing List <pgsql-general(at)postgresql(dot)org> |
Subject: | SQL / per cent change question |
Date: | 2002-07-23 19:04:23 |
Message-ID: | 73309C2FDD95D11192E60008C7B1D5BB04C73D0F@snt452.corp.bcbsm.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Howdy:
Currently running PostgreSQL 7.1.3 on RedHat Linux.
What I'm trying to do is create a table where I have
data loaded every week or so. In that table I'll have
simple things like name, count, date, whatever.
What I'm looking for is for a method to do per cent
difference from each last count that was loaded into
the table.
For instance, I load something like this:
insert into t_change (name, count, date
values ("widgets", "2304", timestamp(now()))
That give me my table and some info, right? Now,
every time that someone updates that table, I've seen
a formula on how to get the per cent between
two columns already inserted in the table, but what
can I do when I have only ONE field and want to get the
difference between that and the load PRIOR to
what I have? That is to say, how can I get the
difference / percent change between "count" and
the count that was loaded, say, a few minutes before
on a routine basis?
Suggestion? Comments? Thanks!
-X
From | Date | Subject | |
---|---|---|---|
Next Message | Hillensbeck, Preston | 2002-07-23 19:30:52 | Re: [SQL] No command history in psql |
Previous Message | Victor Hugo Germano | 2002-07-23 18:51:48 | Readline ... a lot of problems... |