Re: Counting # of consecutive rows with specified value(s)? - Mailing list pgsql-general

From François Beausoleil
Subject Re: Counting # of consecutive rows with specified value(s)?
Date
Msg-id CF7DA474-660B-4EC4-B7E7-60A0C3BE6ABF@teksol.info
Whole thread Raw
In response to Counting # of consecutive rows with specified value(s)?  (Ken Tanzer <ken.tanzer@gmail.com>)
Responses Re: Counting # of consecutive rows with specified value(s)?
List pgsql-general

Le 2012-06-06 à 22:20, Ken Tanzer a écrit :

I can currently test whether someone has at least a specified number of consecutive absences with the query below, but it would be  better to get the actual number.

As a second question, what about getting the number of consecutive records for a set of values?  (e.g., attendance_code IN ('ATTENDED','EXCUSED')

Any ideas or suggestions?  Thanks.

This is similar to the islands and gaps problem. Search for that on StackOverflow and you'll get it.

Bye!
François

pgsql-general by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Problem with pg_upgrade 8.3 to 9.1.4 - clog missing?!
Next
From: Dinsdale
Date:
Subject: Re: Missing row after update