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