From: Richard Broersma Jr <rabroersma@yahoo.com>
To: Ragnar <gnari@hive.is>
Cc: Partha Guha Roy <partha.guha.roy@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Need to subtract values between previous and current row
Date: Fri, 15 Dec 2006 08:21:08 -0800 (PST)
Message-ID: <294943.92264.qm@web31801.mail.mud.yahoo.com> (raw)
In-Reply-To: <1166198816.6369.179.camel@localhost.localdomain>
> not bad, except you miss the initial state for each cid,
> and I do not see how you get the final duration.
> cid | duration | state
> -----+----------+-------
> 101 | 2 | 1
> 101 | 2 | 2
> 101 | 3 | 1
> 101 | 3 | 2
> 102 | 2 | 1
> 102 | 2 | 2
> 102 | 2 | 3
> (7 rows)
Good catch! I should have read the requirements a little more closely, but at 4:30 am when I just
woke up, slight details are very hard for me to focus on. :o)
Regards,
Richard Broersma Jr.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: rabroersma@yahoo.com, gnari@hive.is, partha.guha.roy@gmail.com
Subject: Re: Need to subtract values between previous and current row
In-Reply-To: <294943.92264.qm@web31801.mail.mud.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox