Tuesday, February 14, 2012

Counting Consecutive days in SQL

I've been trying to figure out how to count the number of consecutive
days of entries in a table. the table stores data on number of minutes
exercised in a day for users of an exercise program:
ExerciseId int
UserId int
Minutes int
ExerciseDate datetime
I need to produce a list of users who exercised XX number of days in a
row. e.g. 60 consecutive days of exercise. Any ideas on how to do that?
I'm using SQL Server 2000.
ThanksVibroluxOn10@.gmail.com wrote:
> I've been trying to figure out how to count the number of consecutive
> days of entries in a table. the table stores data on number of minutes
> exercised in a day for users of an exercise program:
> ExerciseId int
> UserId int
> Minutes int
> ExerciseDate datetime
> I need to produce a list of users who exercised XX number of days in a
> row. e.g. 60 consecutive days of exercise. Any ideas on how to do that?
> I'm using SQL Server 2000.
> Thanks
>
http://www.aspfaq.com/show.asp?id=2519

No comments:

Post a Comment