Finding consecutive dates when dates are not truly consecutive
- From: ocayetano@xxxxxxxxx
- Date: 21 Aug 2005 15:35:01 -0700
Hello,
I'm trying to do this in ASE via a straigth SELECT, but I could create
stored procedures if necessary. Here's my SQL problem. I'm trying to
find N consecutive absences for students where the dates are from a
school calendar which excludes weekends (meaning the dates are not
necessarily fully consecutive).
SCHOOL_CALENDAR
INSESSION_DAY
------------
8/25/04
8/26/04
8/27/04
8/30/04
8/31/04
STUDENT_ABSENCES
STUDENTID ABSENCE_DATE
--------------------------
1 8/25/04
1 8/26/04
1 8/31/04
2 8/26/04
2 8/27/04
2 8/30/04
3 8/25/04
3 8/27/04
3 8/31/04
If I query for students with 3 or more consecutive absences, my query
or stored procedure needs to return STUDENTID = 2. Note that even
though this student's dates are not consecutive dates in the strict
sense, they are consecutive according to the school calendar.
Thanks in advance for any help.
Onassis
.
- Follow-Ups:
- Prev by Date: Re: Creating fake rows
- Next by Date: SUN StorEdge DAT 72 && SUNOS 5.9 && ASE 12.5.2
- Previous by thread: Creating fake rows
- Next by thread: Re: Finding consecutive dates when dates are not truly consecutive
- Index(es):
Relevant Pages
|
|