Re: Need to subtract values between previous and current row

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: Ragnar <gnari(at)hive(dot)is>
Cc: Partha Guha Roy <partha(dot)guha(dot)roy(at)gmail(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Need to subtract values between previous and current row
Date: 2006-12-15 16:21:08
Message-ID: 294943.92264.qm@web31801.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> 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.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Ashish Ahlawat 2006-12-15 16:40:22 Re: join and sort on 'best match'
Previous Message Ragnar 2006-12-15 16:06:56 Re: Need to subtract values between previous and current row